A new version of ckanext-spatial (2.1.0) was released this week. Besides the usual gracious contributions from community members and some cleanups to drop support for Python 2 and an old search backend, the main change included in this release is an improved way of configuring the background tiles for map widgets.
A while ago, users of the extension might have seen the following message popping up in their maps:
After many years of being a popular choice as a tile map provider, Stamen stopped providing their tiles as a public service. I chose the Stamen Terrain tiles as the default fallback option for ckanext-spatial map widgets because they didn’t require any registration or setup (besides being really beautiful), making things easier for users installing the extension. But the reality is, that as of October 2023 most if not all map tiles providers out there require at the very least registering to their service and providing some sort of token or key. This makes perfect sense, as maintaining a global tileset updated and served globally requires resources, and providers need some way of tracking usage and limiting abuse.
So the new version of ckanext-spatial won’t setup any pre-configured tile layer on map widgets, and will encourage maintainers to set up their preferred one by displaying a notice:
To provide as many choices as possible, I integrated the excellent Leaflet-providers library, which provides pre-configured access to dozens of map providers.
This means that in most cases, setting up a map provider is just a matter of a couple of configuration options in the CKAN configuration file:
# Stadia / Stamen Terrain ckanext.spatial.common_map.type = Stadia.StamenTerrain ckanext.spatial.common_map.apikey = <your_api_key>
# MapBox ckanext.spatial.common_map.type = MapBox ckanext.spatial.common_map.mapbox.id = <your_map_id> ckanext.spatial.common_map.mapbox.accessToken = <your_access_token>
Sites using the old configuration options should still work, and there is an option to manually configure a layer using the XYZ convention for those wanting to add their own layers.