CARTO Basemap
The CARTO Basemap is the default Basemap and it is included in all CARTO accounts. Outside a CARTO account, the same basemaps are available with a free API key. It uses the Open Source project Maplibre GL JS and CARTO base maps API.
At the Basemaps section of CARTO for deck.gl you can find further information about how to use it. CARTO also provides a set of Basemaps Styles to easily adapt to multiple visualization contexts (dark, light, and voyager).
A code example is available in the guide Build a public application.
Further style customization
If you don't need to change a style, use its URL directly with your key, for example https://basemaps.cartocdn.com/gl/positron-gl-style/style.json?key=YOUR_KEY. You can also host a copy of it as is, but its tile, glyphs and sprite URLs (under /v/<release>/) are dynamic and change, so a hosted copy can break at any time; to stay current, use our style URL with ?key=.
If the Basemaps Styles provided by CARTO are not enough and you need to go further to customize those styles you can do the following:
Download the style json as a reference, to compare and see how we build it.
https://basemaps.cartocdn.com/gl/positron-gl-style/style.jsonModify the styles to match your requirements. Your style uses your own glyphs (fonts) and sprite (icons); only its vector source points to our TileJSON, which always serves the current tiles:
"url": "https://tiles.basemaps.cartocdn.com/vector/carto.streets/v2/tiles.json?key=YOUR_KEY". Don't keep the tile,glyphsandspriteURLs of the downloaded file: they are dynamic and change.Put it in a public url.
Pass to deck.gl the mapStyle you want to use:
const deckgl = new deck.DeckGL({
...
map: maplibregl,
mapStyle: '<your styles json url>',
});If you need a UI to modify the styles, take a look at Maputnik (A free and open visual editor tool for editing Basemaps styles).
Last updated
Was this helpful?
