1

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

2

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.

6
  • Thanks for the code. But it is fetching the underlying map data, not the visualization, yes? It is the visualization that I am after. Feb 5, 2014 at 19:59
  • Is this still the only solution?
    – knutole
    Mar 12, 2014 at 23:15
  • Password protected maps are now an option, blog.cartodb.com/post/78555009263/… Mar 13, 2014 at 20:44
  • What's the difference between private data and private maps?
    – knutole
    Mar 17, 2014 at 0:05
  • I think this answer uses deprecated api.
    – Oren
    Apr 19, 2015 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.