3

I am trying to learn how to use CartoDB and the CartoDB APIs - in particular the Maps API. I'm following along with the Named Maps Tutorial but I'm experiencing some confusion. When I create a named map using the Maps API it does not appear in the web interface. Here is the example MapConfig file that I'm using (called config.json):

{
  "version": "0.0.1",
  "name": "namedmap_tutorial",
  "auth": {
    "method": "open"
  },
  "layergroup": {
    "layers": [{
      "type": "cartodb",
      "options": {
        "cartocss_version": "2.1.1",
        "sql": "SELECT * FROM named_map_tutorial_table",
        "interactivity": ["cartodb_id", "name", "pop_max"]
      }
    }]
  }
}

It is a slightly abridged version of the example given in the tutorial (which I also tried using verbatim with identical results).

And here is the command I run to create the map:

curl \
-H 'Content-Type: application/json' \
-d '@MapConfig.json' \
-- \
"https://accountname.cartodb.com/api/v1/map/named?api_key=${CARTODB_API_KEY}"

After running the map creation command I get the following output:

{"template_id":"namedmap_tutorial"}

So it appears that the command executed successfully. As a sanity-check I run a command to list all named maps:

curl -s \
-- \
"https://accountname.cartodb.com/api/v1/map/named?api_key=${CARTODB_API_KEY}" \
| jq -r .template_ids[]

And sure enough, I get the following output:

namedmap_tutorial

Unfortunately when I go to the web interface I don't see the map appear in the dashboard. Why does my map not appear in the dashboard? How do I programmatically create maps in CartoDB?

1 Answer 1

5

Named maps created via API != visualizations or maps in your CartoDB account.

The Named Maps API allows you to create maps that you can use programatically, but this will not generate a visualization in the CartoDB Editor. Right now, there's no "visualizations API" to create maps that appear in your Editor directly. The Named Maps will exist for your user, but won't be visible via Editor.

This happens similarly with tables, although these can be made visible in the Editor by "adapting" them. You can create tables in your CartoDB database via SQL API but these won't appear in the Editor. In this case, for the table to appear in your Editor you need to CartoDBfy it (SELECT CDB_CartoDBfytable('tablename')) for the Editor to be able to register it.

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.