1

Until recently Mapquest provided the de-facto standard for open tile access for OpenStreetMap data. In June they announced they are renewing their services. As a consequence current Mapquest basemaps in Geonode 2.4 were not functional as of 11th of July 2016.

Although we might consider using Mapquest again later, we are now looking at using Stamen maps based on their recent announcement.

To do this we will have to add their tile-reference information in our geonode settings-file. After removing Mapquest the relevant part in geonode settings.py looks like this:

MAP_BASELAYERS = [{
    "source": {"ptype": "gxp_olsource"},
    "type": "OpenLayers.Layer",
    "args": ["No background"],
    "visibility": False,
    "fixed": True,
    "group":"background"
}, {
    "source": {"ptype": "gxp_osmsource"},
    "type": "OpenLayers.Layer.OSM",
    "name": "mapnik",
    "visibility": True,
    "fixed": True,
    "group": "background"
}]

Some background information about the Stamen tile services is available.

How do we append the above settings to add Stamen maps (primarily the terrain maps) as one of our our default background basemaps?

  • Commit in geonde on GitHub provides some clues. Newer versions of Geonode will have Stamen maps as possible basemaps. But the question remains - how can we fix this for geonode 2.4? github.com/GeoNode/geonode/commit/… – ragnvald Aug 10 '16 at 8:16
1

Using an slightly similar answer to a question on "How to use arcgis maps in Geonode" as well as a gist from Daniel Berry the solution is as follows.

Add/replace the following section to the baselayer part of your settings.py-file:

STAMEN_ATTR = ('Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a'
               ' href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</'
               'a> &mdash; Map data &copy; <a href="http://www.openstreetmap.o'
               'rg/copyright">OpenStreetMap</a>')

MAP_BASELAYERS = [{
    "source": {"ptype": "gxp_olsource"},
    "type": "OpenLayers.Layer",
    "args": ["No background"],
    "visibility": False,
    "fixed": True,
    "group":"background"
}, {
    "source": {"ptype": "gxp_osmsource"},
    "type": "OpenLayers.Layer.OSM",
    "name": "mapnik",
    "visibility": True,
    "fixed": True,
    "group": "background"
}, {
    "source": {"ptype": "gxp_olsource"},
    "type": "OpenLayers.Layer.XYZ",
    "args": [
        'Stamen Terrain',
        'http://stamen-tiles-a.a.ssl.fastly.net/terrain/${z}/${x}/${y}.png',
        {
            'transitionEffect': 'resize',
            'attribution': '%s' % STAMEN_ATTR,
        }
    ],
    "visibility": False,
    "fixed": True,
    "group": "background"
}, {
    "source": {"ptype": "gxp_olsource"},
    "type": "OpenLayers.Layer.XYZ",
    "args": [
        'Stamen Toner',
        'http://stamen-tiles-a.a.ssl.fastly.net/toner/${z}/${x}/${y}.png',
        {
            'transitionEffect': 'resize',
            'attribution': '%s' % STAMEN_ATTR,
        }
    ],
    "visibility": False,
    "fixed": True,
    "group": "background"
}, {
    "source": {"ptype": "gxp_olsource"},
    "type": "OpenLayers.Layer.XYZ",
    "args": [
        'Stamen Toner Lite',
        'http://stamen-tiles-a.a.ssl.fastly.net/toner-lite/${z}/${x}/${y}.png',
        {
            'transitionEffect': 'resize',
            'attribution': '%s' % STAMEN_ATTR,
        }
    ],
    "visibility": False,
    "fixed": True,
    "group": "background"
}, {
    "source": {"ptype": "gxp_olsource"},
    "type": "OpenLayers.Layer.XYZ",
    "args": [
        'Stamen Watercolor',
        'http://stamen-tiles-a.a.ssl.fastly.net/watercolor/${z}/${x}/${y}.png',
        {
            'transitionEffect': 'resize',
            'attribution': '%s' % STAMEN_ATTR,
        }
    ],
    "visibility": False,
    "fixed": True,
    "group": "background"
}]

The settings are picked up when geonode restarts. Quick and dirty way to do this is to restart the server.

The settings are available for new maps. For existing maps the map alternatives have been stored in the database and you will have to update them manually. This can be done only through superuser access to geonode. Open the admin user interface, select maps and then choose the relevant map. As all existing maps will have the definitions (alternatives) active at the time of creation you will have to do this update manually for each map. Start with removing the Mapquest layers and then add the stamen maps of your choice. This will have to be done by copying in attributes from an existing (new map). It will take some time and patience, but it will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.