I would like to use cartodb.js in my web page reproduce a visualization that I created at CartoDB. But I want to keep private my visualization and data at CartoDB (and I am going to secure my web page).
Is there a way to use the APIs in cartodb.js with my CartoDB API key somehow to reproduce in my web page the private visualization that I see on my CartoDB site?
I've been studying the documentation, examples, and source code for cartodb.js. As far as I can tell, cartodb.js does not really provide for use of my API key, but perhaps I am missing something.
1 Answer 1
Take a look at this example I wrote a while back,
https://github.com/andrewxhill/cartodb-examples/blob/gh-pages/private-maps/index.html
It would present you with a form where you drop your api-key and it will create the map. You can use it as a starting point if you just want to write your api_key directly into the file.
The way to do it in the library is to create a layer with extra_params
,
cartodb.createLayer(map, {
type: 'cartodb',
user_name: user,
sublayers: [layer1, layer2],
extra_params: {
map_key: key
}
})
We are also going to be released a new tier of privacy for maps in the coming weeks. It will allow you to publish maps from private data.
-
Thanks for the code. But it is fetching the underlying map data, not the visualization, yes? It is the visualization that I am after.user2701479– user27014792014年02月05日 19:59:26 +00:00Commented Feb 5, 2014 at 19:59
-
Is this still the only solution?knutole– knutole2014年03月12日 23:15:09 +00:00Commented Mar 12, 2014 at 23:15
-
Password protected maps are now an option, blog.cartodb.com/post/78555009263/…andrewxhill– andrewxhill2014年03月13日 20:44:57 +00:00Commented Mar 13, 2014 at 20:44
-
What's the difference between private data and private maps?knutole– knutole2014年03月17日 00:05:38 +00:00Commented Mar 17, 2014 at 0:05
-
I think this answer uses deprecated api.Oren– Oren2015年04月19日 19:51:56 +00:00Commented Apr 19, 2015 at 19:51
Explore related questions
See similar questions with these tags.