Skip to content

Instantly share code, notes, and snippets.

@BerryDaniel
Created August 10, 2016 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BerryDaniel/90e1d27fdc763b34ca942f6658a945ac to your computer and use it in GitHub Desktop.
Save BerryDaniel/90e1d27fdc763b34ca942f6658a945ac to your computer and use it in GitHub Desktop.
Example GeoNode local_settings.py file with STAMEN Basemaps
# -*- coding: utf-8 -*-
from geonode import LOCAL_GEOSERVER
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 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"
}]
baselayers = MAP_BASELAYERS
MAP_BASELAYERS = [LOCAL_GEOSERVER]
MAP_BASELAYERS.extend(baselayers)
@ragnvald
Copy link

ragnvald commented Aug 11, 2016

Pasted the above at the end of my local settings file (/etc/geonode/local_settings.py), and geonode crashed. I am running 2.4.

@ragnvald
Copy link

ragnvald commented Aug 11, 2016

Added some documentation on the stackexchange question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment