How do I add a CARTO layer to Fulcrum?

Learn how to create and add map layers in Fulcrum from CARTO

Cory MacVie avatar
Written by Cory MacVie
Updated over a week ago

CARTO supports direct tile access via Named Maps. In order to load your CARTO layers into Fulcrum, you must first create a Named Map. This cannot currently by done in the CARTO Editor, so you have to manually create it using the Named Maps API.

  1. Create a JSON template (template.json):

{
  "version": "0.0.1",
  "name": "tax_parcels",
  "layergroup": {
    "layers": [{
      "type": "cartodb",
      "options": {
        "cartocss_version": "2.1.1",
        "cartocss": "#tax_parcels{polygon-opacity: 0;line-color: #D6301D;line-width: 1.5;line-opacity: 1;}",
        "sql": "SELECT * FROM tax_parcels"
      }
    }]
  }
}

2) Use the command line or terminal to POST that template to the named maps API:

curl -X POST \
  -H 'Content-Type: application/json' \
  -d @template.json \
  'https://{username}.carto.com/api/v1/map/named/?api_key={api_key}'

3) Proceed with adding the map layer to Fulcrum using the following URL scheme: "https://{username}.carto.com/api/v1/map/named/{layer_name}/all/{z}/{x}/{y}.png"

You can read more about Named Maps in CARTO here. For more information on adding map layers from other popular web services, please visit our guide on Adding Map Layers From Web Mapping Services.

Did this answer your question?