From 20e9a57e6b2fbe678ef2eb6557f8225579c65ae6 Mon Sep 17 00:00:00 2001 From: Ariel Nunez Date: Thu, 15 Sep 2011 20:17:57 +0000 Subject: [PATCH 1/7] Removed Google from the default list of layers --- src/GeoNodePy/geonode/settings.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/GeoNodePy/geonode/settings.py b/src/GeoNodePy/geonode/settings.py index 0e9a21e37bc..ad67517493a 100644 --- a/src/GeoNodePy/geonode/settings.py +++ b/src/GeoNodePy/geonode/settings.py @@ -181,10 +181,6 @@ "capra": { "url":"/geoserver/wms" }, - "google":{ - "ptype":"gx_googlesource", - "apiKey": GOOGLE_API_KEY - } } MAP_BASELAYERS = [{ @@ -218,12 +214,7 @@ }, {"buffer":0} ] - },{ - "source":"google", - "group":"background", - "name":"SATELLITE", - "visibility": False, - "fixed": True, + }] # NAVBAR expects a dict of dicts or a path to an ini file From d9b80938241ed943333abc647870b227f1976683 Mon Sep 17 00:00:00 2001 From: Ariel Nunez Date: Thu, 15 Sep 2011 20:22:04 +0000 Subject: [PATCH 2/7] Renamed the capra source layer to local --- src/GeoNodePy/geonode/settings.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GeoNodePy/geonode/settings.py b/src/GeoNodePy/geonode/settings.py index ad67517493a..8859d2fde5d 100644 --- a/src/GeoNodePy/geonode/settings.py +++ b/src/GeoNodePy/geonode/settings.py @@ -178,7 +178,9 @@ "any": { "ptype":"gx_olsource" }, - "capra": { + # It is important to have this layer named local because + # it should be the first one in the add layers dialog. + "local": { "url":"/geoserver/wms" }, } From 2389d4ee2740681b77895423753d23c1eba41523 Mon Sep 17 00:00:00 2001 From: Ariel Nunez Date: Thu, 15 Sep 2011 20:33:39 +0000 Subject: [PATCH 3/7] Added the restUrl parameter to the local baselayer --- src/GeoNodePy/geonode/settings.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GeoNodePy/geonode/settings.py b/src/GeoNodePy/geonode/settings.py index 8859d2fde5d..c63fe3d3991 100644 --- a/src/GeoNodePy/geonode/settings.py +++ b/src/GeoNodePy/geonode/settings.py @@ -181,7 +181,9 @@ # It is important to have this layer named local because # it should be the first one in the add layers dialog. "local": { - "url":"/geoserver/wms" + "ptype":"gxp_wmscsource", + "url":"/geoserver/wms", + "restUrl": "/gs/rest" }, } From 994e906fa452873ed1682d4adb8aadb0dca9b8c1 Mon Sep 17 00:00:00 2001 From: Ariel Nunez Date: Thu, 15 Sep 2011 20:38:42 +0000 Subject: [PATCH 4/7] Added MAP_BASELAYERSOURCES by default to the serialized map --- src/GeoNodePy/geonode/maps/models.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/GeoNodePy/geonode/maps/models.py b/src/GeoNodePy/geonode/maps/models.py index c275500c92b..ed0f2733249 100644 --- a/src/GeoNodePy/geonode/maps/models.py +++ b/src/GeoNodePy/geonode/maps/models.py @@ -1262,7 +1262,7 @@ def viewer_json(self, *added_layers): """ layers = list(self.layer_set.all()) + list(added_layers) #implicitly sorted by stack_order server_lookup = {} - sources = dict() + sources = settings.MAP_BASELAYERSOURCES def uniqify(seq): """ @@ -1278,10 +1278,6 @@ def uniqify(seq): return results configs = [l.source_config() for l in layers] - configs.insert(0, { - "ptype":"gxp_wmscsource", - "url": "/geoserver/wms", - "restUrl": "/gs/rest"}) i = 0 for source in uniqify(configs): From 4f70c187817499aa90bd614e57791666d88cd28e Mon Sep 17 00:00:00 2001 From: Ariel Nunez Date: Thu, 15 Sep 2011 20:52:48 +0000 Subject: [PATCH 5/7] Added documentation about configuring Google and Bing base layers --- docs/source/deploy/production.rst | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/docs/source/deploy/production.rst b/docs/source/deploy/production.rst index 7612ead6357..7be45003fce 100644 --- a/docs/source/deploy/production.rst +++ b/docs/source/deploy/production.rst @@ -24,6 +24,58 @@ By default GeoNode runs in ``http://localhost/``, but when running in production To configure it, edit the ``SITEURL`` setting in ``local_settings.py`` (which can be found either in your GeoNodePy/src/geonode folder or in ``/etc/geonode/local_settings.py`` if you used an automated installer. +Adding layers from Google, Bing and other providers +--------------------------------------------------- + +Bing +++++ + +Get an API key from Microsoft at http://bingmapsportal.com/ and place it in ``local_settings.py``, for example:: + + BING_API_KEY="zxcxzcXAWdqwdQWWQEDzxcxz" + +Copy the ``MAP_BASELAYERSOURCES`` dictionary from ``settings.py`` into ``local_settings.py`` and add the following snippet:: + + "bing":{ + "ptype":"gxp_bingsource", + "apiKey": BING_API_KEY + } + +Add the following to ``MAP_BASELAYERS``:: + + },{ + "source":"bing", + "group":"background", + "name":"Aerial", + "visibility": False, + "fixed": True, + + + +Google +++++++ + +Get an API key from Google at http://code.google.com/apis/maps/signup.html and place it in ``local_settings.py``, for example:: + + GOOGLE_API_KEY="zxcxzcXAWdqwdQWWQEDzxcxz" + +Copy the ``MAP_BASELAYERSOURCES`` dictionary from ``settings.py`` into ``local_settings.py`` and add the following snippet:: + + "google":{ + "ptype":"gxp_googlesource", + "apiKey": GOOGLE_API_KEY + } + +Add the following to ``MAP_BASELAYERS``:: + + },{ + "source":"google", + "group":"background", + "name":"SATELLITE", + "visibility": False, + "fixed": True, + + Robot Exclusion File -------------------- From 4a335a2e0c8b97f1de57a1db25a31da276ffb634 Mon Sep 17 00:00:00 2001 From: Ariel Nunez Date: Thu, 15 Sep 2011 22:08:04 +0000 Subject: [PATCH 6/7] Created new LOCAL_LAYER_SOURCE setting and removed MAP_BASELAYERSOURCES --- src/GeoNodePy/geonode/maps/models.py | 2 +- src/GeoNodePy/geonode/maps/views.py | 2 +- src/GeoNodePy/geonode/settings.py | 21 +++++++-------------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/GeoNodePy/geonode/maps/models.py b/src/GeoNodePy/geonode/maps/models.py index ed0f2733249..48caf7bd97d 100644 --- a/src/GeoNodePy/geonode/maps/models.py +++ b/src/GeoNodePy/geonode/maps/models.py @@ -1262,7 +1262,7 @@ def viewer_json(self, *added_layers): """ layers = list(self.layer_set.all()) + list(added_layers) #implicitly sorted by stack_order server_lookup = {} - sources = settings.MAP_BASELAYERSOURCES + sources = {'local': settings.LOCAL_LAYER_SOURCE } def uniqify(seq): """ diff --git a/src/GeoNodePy/geonode/maps/views.py b/src/GeoNodePy/geonode/maps/views.py index 67b4aed1ecb..6c267db3eb5 100644 --- a/src/GeoNodePy/geonode/maps/views.py +++ b/src/GeoNodePy/geonode/maps/views.py @@ -62,7 +62,7 @@ def _baselayer(lyr, order): return MapLayer.objects.from_viewer_config( map = _default_map, layer = lyr, - source = settings.MAP_BASELAYERSOURCES[lyr["source"]], + source = lyr["source"], ordering = order ) diff --git a/src/GeoNodePy/geonode/settings.py b/src/GeoNodePy/geonode/settings.py index c63fe3d3991..b7e9a8d584e 100644 --- a/src/GeoNodePy/geonode/settings.py +++ b/src/GeoNodePy/geonode/settings.py @@ -174,35 +174,28 @@ # maximum zoom is between 12 and 15 (for Google Maps, coverage varies by area) DEFAULT_MAP_ZOOM = 7 -MAP_BASELAYERSOURCES = { - "any": { - "ptype":"gx_olsource" - }, - # It is important to have this layer named local because - # it should be the first one in the add layers dialog. - "local": { - "ptype":"gxp_wmscsource", - "url":"/geoserver/wms", - "restUrl": "/gs/rest" - }, +DEFAULT_LAYER_SOURCE = { + "ptype":"gxp_wmscsource", + "url":"/geoserver/wms", + "restUrl": "/gs/rest" } MAP_BASELAYERS = [{ - "source":"any", + "source": {"ptype": "gx_olsource"}, "type":"OpenLayers.Layer", "args":["No background"], "visibility": False, "fixed": True, "group":"background" },{ - "source":"any", + "source": { "ptype":"gx_olsource"}, "type":"OpenLayers.Layer.OSM", "args":["OpenStreetMap"], "visibility": True, "fixed": True, "group":"background" },{ - "source":"any", + "source": {"ptype":"gx_olsource"}, "type":"OpenLayers.Layer.WMS", "group":"background", "visibility": False, From 7110599325d309a9b09f6f0f29d1980cface41c0 Mon Sep 17 00:00:00 2001 From: Ariel Nunez Date: Thu, 15 Sep 2011 23:06:44 +0000 Subject: [PATCH 7/7] Fixed documentation to use only MAP_BASELAYERSOURCES --- docs/source/deploy/production.rst | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/docs/source/deploy/production.rst b/docs/source/deploy/production.rst index 7be45003fce..5e355823e64 100644 --- a/docs/source/deploy/production.rst +++ b/docs/source/deploy/production.rst @@ -30,21 +30,13 @@ Adding layers from Google, Bing and other providers Bing ++++ -Get an API key from Microsoft at http://bingmapsportal.com/ and place it in ``local_settings.py``, for example:: - - BING_API_KEY="zxcxzcXAWdqwdQWWQEDzxcxz" - -Copy the ``MAP_BASELAYERSOURCES`` dictionary from ``settings.py`` into ``local_settings.py`` and add the following snippet:: - - "bing":{ - "ptype":"gxp_bingsource", - "apiKey": BING_API_KEY - } - -Add the following to ``MAP_BASELAYERS``:: +Get an API key from Microsoft at http://bingmapsportal.com/ and place it in ``local_settings.py``. Add the following to ``MAP_BASELAYERS``:: },{ - "source":"bing", + "source": { + "ptype":"gxp_bingsource", + "apiKey": "YOUR_BING_API" + }, "group":"background", "name":"Aerial", "visibility": False, @@ -59,17 +51,13 @@ Get an API key from Google at http://code.google.com/apis/maps/signup.html and p GOOGLE_API_KEY="zxcxzcXAWdqwdQWWQEDzxcxz" -Copy the ``MAP_BASELAYERSOURCES`` dictionary from ``settings.py`` into ``local_settings.py`` and add the following snippet:: +Copy the ``MAP_BASELAYERS`` dictionary from ``settings.py`` into ``local_settings.py`` and add the following snippet:: - "google":{ + },{ + "source": { "ptype":"gxp_googlesource", "apiKey": GOOGLE_API_KEY - } - -Add the following to ``MAP_BASELAYERS``:: - - },{ - "source":"google", + }, "group":"background", "name":"SATELLITE", "visibility": False,