geonetwork / core-geonetwork

GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
http://geonetwork-opensource.org/
GNU General Public License v2.0
428 stars 489 forks source link

Failure to load a layer from a mapproxy wms/wmts service #821

Closed landryb closed 9 years ago

landryb commented 9 years ago

Loading http://tiles.craig.fr/ortho/service? in the map viewer as a WMS service it correctly shows the layer tree, but when i try to load a layer from the list, the tree is collapsed and firebug spits an error about a missing extent

Error: extent is undefined ol.extent.applyTransform@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/ngeo/ngeo-debug.js:18280:5 
ol.proj.transformExtent@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/ngeo/ngeo-debug.js:19301:10 
this.$get</<.getLayerExtentFromGetCap@http://geonetwork.demo.craig.fr/geonetwork/catalog/components/common/ows/OWSService.js:150:24
this.$get</<.createOlWMSFromCap@http://geonetwork.demo.craig.fr/geonetwork/catalog/components/common/map/mapService.js:318:25
this.$get</<.addWmsToMapFromCap@http://geonetwork.demo.craig.fr/geonetwork/catalog/components/common/map/mapService.js:325:25
.controller</this.addLayer@http://geonetwork.demo.craig.fr/geonetwork/catalog/components/viewer/wmsimport/WmsImportDirective.js:40:22
.link/select@http://geonetwork.demo.craig.fr/geonetwork/catalog/components/viewer/wmsimport/WmsImportDirective.js:325:13
.link/scope.handle@http://geonetwork.demo.craig.fr/geonetwork/catalog/components/viewer/wmsimport/WmsImportDirective.js:346:15
$parseFunctionCall@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:12233:15
ngEventHandler/</callback@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:22824:17
$RootScopeProvider/this.$get</Scope.prototype.$eval@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:14287:16
$RootScopeProvider/this.$get</Scope.prototype.$apply@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:14385:18
ngEventHandler/<@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:22829:17
jQuery.event.dispatch@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/jquery-2.0.3.js:4675:15
jQuery.event.add/elemData.handle@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/jquery-2.0.3.js:4360:6

Trying to load the same service as a WMTS fails to parse the getcapabilities:

Error: Assertion failed goog.debug.Error@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/ngeo/ngeo-debug.js:2560:17
goog.asserts.AssertionError@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/ngeo/ngeo-debug.js:4252:1
goog.asserts.doAssertFailure_@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/ngeo/ngeo-debug.js:4309:11
goog.asserts.assert@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/ngeo/ngeo-debug.js:4339:1
ol.format.WMTSCapabilities.prototype.readFromNode@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/ngeo/ngeo-debug.js:98298:3
ol.format.WMTSCapabilities.prototype.readFromDocument@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/ngeo/ngeo-debug.js:98285:1
ol.format.XML.prototype.read@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/ngeo/ngeo-debug.js:94303:12
this.$get</parseWMTSCapabilities@http://geonetwork.demo.craig.fr/geonetwork/catalog/components/common/ows/OWSService.js:60:24
this.$get</<.getWMTSCapabilities/<@http://geonetwork.demo.craig.fr/geonetwork/catalog/components/common/ows/OWSService.js:129:37
$http/promise.success/<@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:9278:11
processQueue@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:13071:27
scheduleProcessQueue/<@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:13087:27
$RootScopeProvider/this.$get</Scope.prototype.$eval@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:14287:16
$RootScopeProvider/this.$get</Scope.prototype.$digest@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:14103:15
$RootScopeProvider/this.$get</Scope.prototype.$apply@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:14391:13
done@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:9567:36
completeRequest@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:9752:7
requestLoaded@http://geonetwork.demo.craig.fr/geonetwork/catalog/lib/angular/angular.js:9695:1

I know the map viewer is not meant to be a fullblown websig, just filing issues so i dont lose track of this...

fgravin commented 9 years ago

The code is based on: https://github.com/geonetwork/core-geonetwork/blob/develop/web-ui/src/main/resources/catalog/components/common/ows/OWSService.js#L150

So we should add a test and process the BoundingBox tag instead if empty.

landryb commented 9 years ago

The service responds both to WMS and WMTS queries on the same URL, it's just that the gfx component doesnt add ?service=WMTS to the url when requesting the getcapabilities.

Using http://tiles.craig.fr/ortho/service?service=WMTS as url allows me to load a WMTS layer from this service. Maybe the service should be automatically added like request=GetCapabilities ?

fgravin commented 9 years ago

Using http://tiles.craig.fr/ortho/service?service=WMTS as url allows me to load a WMTS layer from this service. Maybe the service should be automatically added like request=GetCapabilities ?

Yes, i can do that, i did it for WMS. https://github.com/geonetwork/core-geonetwork/blob/develop/web-ui/src/main/resources/catalog/components/common/ows/OWSService.js#L91

fgravin commented 9 years ago

Using http://tiles.craig.fr/ortho/service?service=WMTS as url allows me to load a WMTS layer from this service. Maybe the service should be automatically added like request=GetCapabilities ?

Done in https://github.com/geonetwork/core-geonetwork/commit/a515e5addf7af2f11a33f6c2ad97e46f87a1f4d3