This week the visualization of maps inside of CKAN has been broken.

The default provider of layers (MapQuest) has changed its policy, and we haven’t much time to react.

This is an example of map with the change:

To solve this, we need to change the default layer provider in the CKAN configuration file (geoview and spatial plugins) and in the default viewer (reclineView plugin).

We have choose Specifically this visualization:

These are the steps to follow to do this change:

a) CKAN Configuration

In CKAN configuration file we must add these lines after the entry ckan.plugins:

ckanext.spatial.common_map.type = custom
ckanext.spatial.common_map.custom.url ={z}/{x}/{y}.png
ckanext.spatial.common_map.attribution = Maps &copy; <ahref=””>Thunderforest</a>, Data &copy; <aa href=””>OpenStreetMap contributors</a>

b) Default viewer

Edit the file recline.js, which is stored in the path:

/usr/lib/ckan/default/src/ckan/ckanext/reclineview/theme/public/vendor/recline/recline.js is CKAN 2.5


/usr/lib/ckan/default/src/ckan/ckanext/reclinepreview/theme/public/vendor/recline/recline.js in CKAN 2.2

In this file there are two variables with this values:

var mapUrl = “//otile{s}{z}/{x}/{y}.png”;
var osmAttribution = ‘Map data &copy; 2011 OpenStreetMap contributors, Tiles Courtesy of <a href=”” target=”_blank”>MapQuest</a> <img src=”//”>’;

We must change the two values for these:

mapUrl = “//{z}/{x}/{y}.png”;
osmAttribution = ‘Maps &copy; <a href=””>Thunderforest</a>, Data &copy; <a href=””>OpenStreetMap contributors</a>’;

c) Restart Apache2 and Nginx

With that steps the visualization of maps will be fine again.

We hope this information helps you.