MapStory / mapstory-meta

MapStory
http://mapstory.org
32 stars 16 forks source link

layer problems with recent geoserver and virtual service #275

Closed ischneider closed 12 years ago

ischneider commented 12 years ago

For some background: https://groups.google.com/a/opengeo.org/group/dev-mapstory/browse_thread/thread/e52db1a125e080e1?hl=en#

The problem is that recent geoserver builds do not include the workspace name in the virtual WMS getcapabilities response. This results in a layer not appearing in the viewer. At the time of this writing, this is not reproduceable on the dev server. A recent geoserver trunk build is needed. Removing the workspace name on the server side 'fixes' this issue.

bartvde commented 12 years ago

The main reason is that we do a findExact in gxp's WMSSource plugin:

var index = this.store.findExact("name", config.name);

Maybe we could detect if a URL is virtual service, and then also match without the prefix? But if feels kind of hacky.

bartvde commented 12 years ago

We can easily fix this at the GeoExplorer level, I think that makes more sense and is less hacky.

However it's kind of hard to make it work for both the old as well as the new situation, let me know when it makes sense to make the switch.

Warning generated with: https://github.com/opengeo/gxp/commit/03a77ee4b90c52b6cc7d077d1b50b63744f494c1

bartvde commented 12 years ago

This would be the change in GeoExplorer.js:


diff --git a/src/geonode-client/app/static/script/app/GeoExplorer.js b/src/geonode-client/app/static/script/app/GeoExplorer.js
index dc6146b..d56c01e 100644
--- a/src/geonode-client/app/static/script/app/GeoExplorer.js
+++ b/src/geonode-client/app/static/script/app/GeoExplorer.js
@@ -654,7 +654,7 @@ var GeoExplorer = Ext.extend(gxp.Viewer, {
                     }
                     this.createLayerRecord({
                         source: startSourceId,
-                        name: fromLayer
+                        name: fromLayer.split(":").pop()
                     }, function(record) {
                         this.mapPanel.layers.add([record]);
                         this.mapPanel.map.zoomToExtent(record.getLayer().maxExtent);
bartvde commented 12 years ago

This would also require a Django change in the data page where the sources and layers are created for the viewer, it would need to do something similar as is done in javascript above.

config = Ext.apply(config, {"sources": {"1": {"url": "http://localhost:8080/geoserver/geonode/DC/wms", "restUrl": "/gs/rest", "ptype": "gxp_wmscsource"}, "0": {"ptype": "gx_olsource"}, "local": {"url": "/geoserver/wms", "restUrl": "/gs/rest", "ptype": "gxp_wmscsource"}}, "about": {"abstract": "", "title": ""}, "localGeoServerBaseUrl": "http://localhost:8080/geoserver/", "map": {"layers": [{"opacity": 1, "group": "background", "args": ["No background"], "visibility": false, "source": "0", "fixed": true, "type": "OpenLayers.Layer"}, {"opacity": 1, "group": "background", "args": ["OpenStreetMap"], "visibility": true, "source": "0", "fixed": true, "type": "OpenLayers.Layer.OSM"}, {"opacity": 1, "group": "background", "args": ["bluemarble", "http://maps.opengeo.org/geowebcache/service/wms", {"layers": ["bluemarble"], "tiled": true, "tilesOrigin": [-20037508.34, -20037508.34], "format": "image/png"}, {"buffer": 0}], "visibility": false, "source": "0", "fixed": true, "type": "OpenLayers.Layer.WMS"}, {"opacity": 1, "group": "background", "args": ["Wayne", "http://maps.opengeo.org/geowebcache/service/wms", {"layers": ["Wayne"], "tiled": true, "tilesOrigin": [-20037508.34, -20037508.34], "format": "image/png"}, {"buffer": 0}], "visibility": false, "source": "0", "fixed": true, "type": "OpenLayers.Layer.WMS"}, {"opacity": 1.0, "name": "geonode:DC", "selected": true, "visibility": true, "source": "1", "fixed": false}], "wrapDateLine": false, "projection": "EPSG:900913", "center": [null, null], "zoom": null, "units": "m", "maxResolution": 156543.03390625, "maxExtent": [-20037508.34, -20037508.34, 20037508.34, 20037508.34], "numZoomLevels": 22}, "defaultSourceType": "gxp_wmscsource", "apiKeys": {"google": "ABQIAAAAkofooZxTfcCv9Wi3zzGTVxTnme5EwnLVtEDGnh-lFVzRJhbdQhQgAhB1eT_2muZtc0dl-ZSWrtzmrw"}, "authorizedRoles": ["ROLE_ANONYMOUS"], "id": null});
bartvde commented 12 years ago

I think this has all been addressed right @ischneider ?

Please reopen if I am wrong in closing this ticket.