I'd like to use Planet Labs mosaics as a base layer for my CartoDB map. But it seems to require authentication of some sort. What's the right URL to add it as a custom basemap to my CartoDB map?
1 Answer
A Planet Labs mosaic can be added as a basemap to CartoDB by hardcoding your API key as part of the URL.
Normally, a basemap in CartoDB takes the form of https://tile.server.com/{z}/{x}/{y}
, but Planet Labs requires both an API key and the name of a mosaic, so the form is a little different: https://tiles.planet.com/v0/mosaics/MOSAIC_NAME/{z}/{x}/{y}.png?api_key=API_KEY
.
You'll need to replace MOSAIC_NAME
with the name of the mosaic you want to use and API_KEY
with the key provided by Planet Labs.
Note that if you make this map public, anyone who visits your map can easily determine your API key since it will be used to fetch tiles from Planet.
Disclamer: I work for Planet Labs.
-
2This is not secure, though, as the metadata associated with base maps is public through viz.json urls. Building an app with node and leaflet.js is the easiest secure way to have the mosaic map used as the API key is protected then. Sep 19, 2015 at 16:03
-
Yes, you can simply inspect the traffic from the browser to the tile server as each request will have the API key in the URL. But it's useful for visualising data on the mosaic.– bosthSep 19, 2015 at 16:11
-