From 33b9d5e435328c13e278e446f54cc9e26282b4ed Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Mon, 7 Jan 2013 13:34:59 +0100 Subject: [PATCH 01/10] Add initial WCS support --- lib/GeoExt/data/WCSCapabilitiesReader.js | 122 +++++++++++ .../GeoExt/data/WCSCapabilitiesReader.html | 62 ++++++ .../lib/GeoExt/data/WCSCapabilitiesReader.js | 198 ++++++++++++++++++ 3 files changed, 382 insertions(+) create mode 100644 lib/GeoExt/data/WCSCapabilitiesReader.js create mode 100644 tests/lib/GeoExt/data/WCSCapabilitiesReader.html create mode 100644 tests/lib/GeoExt/data/WCSCapabilitiesReader.js diff --git a/lib/GeoExt/data/WCSCapabilitiesReader.js b/lib/GeoExt/data/WCSCapabilitiesReader.js new file mode 100644 index 00000000..ff889a96 --- /dev/null +++ b/lib/GeoExt/data/WCSCapabilitiesReader.js @@ -0,0 +1,122 @@ +/** + * Copyright (c) 2008-2011 The Open Source Geospatial Foundation + * + * Published under the BSD license. + * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text + * of the license. + */ + +/** + * @require OpenLayers/Format/WCSCapabilities.js + * @require OpenLayers/Format/WCSCapabilities/v1_0_0.js + * @require OpenLayers/Format/WCSCapabilities/v1_1_0.js + */ + +/** api: (define) + * module = GeoExt.data + * class = WCSSCapabilitiesReader + * base_link = `Ext.data.DataReader `_ + */ +Ext.namespace("GeoExt.data"); + +/** api: constructor + * .. class:: WCSCapabilitiesReader(meta, recordType) + * + * :param meta: ``Object`` Reader configuration from which: + * ``fields`` is a list of fields to be extracted from the WCS GetCapabilities request. + * :param recordType: ``Array | Ext.data.Record`` An array of field + * configuration objects or a record object. Default is + * :class:`GeoExt.data.LayerRecord`. + * + * Data reader class to create an array of + * :class:`Ext.data.Record` objects from a WCS GetCapabilities + * response. + */ +GeoExt.data.WCSCapabilitiesReader = function(meta, recordType) { + meta = meta || {}; + if(!meta.format) { + meta.format = new OpenLayers.Format.WCSCapabilities(); + } + // Create some default items if recordType is not specified + if(!(typeof recordType === "function")) { + fields = recordType || meta.fields || [ + {name: "title", type: "string"}, + {name: "namespace", type: "string", mapping: "featureNS"}, + {name: "abstract", type: "string"} + ]; + + // Make sure we always have an identifier attribute; + // this will be needed by readRecords. + fields.push({name: "identifier", type: "string"}); // same as WFS "name" + recordType = Ext.data.Record.create(fields); + } + + GeoExt.data.WCSCapabilitiesReader.superclass.constructor.call( + this, meta, recordType + ); +}; + +Ext.extend(GeoExt.data.WCSCapabilitiesReader, Ext.data.DataReader, { + + /** private: method[read] + * :param request: ``Object`` The XHR object which contains the parsed XML + * document. + * :return: ``Object`` A data block which is used by an ``Ext.data.Store`` + * as a cache of ``Ext.data.Record`` objects. + */ + read: function(request) { + var data = request.responseXML; + if(!data || !data.documentElement) { + data = request.responseText; + } + return this.readRecords(data); + }, + + /** private: method[readRecords] + * :param data: ``DOMElement | String | Object`` A document element or XHR + * response string. As an alternative to fetching capabilities data + * from a remote source, an object representing the capabilities can + * be provided given that the structure mirrors that returned from the + * capabilities parser. + * :return: ``Object`` A data block which is used by an ``Ext.data.Store`` + * as a cache of ``Ext.data.Record`` objects. + * + * Create a data block containing Ext.data.Records from an XML document. + */ + readRecords: function(data) { + if(typeof data === "string" || data.nodeType) { + data = this.meta.format.read(data); + } + + var contents = data.contentMetadata; + var fields = this.recordType.prototype.fields; + + var coverageSummary, values, field, v; + + + + var records = []; + + for(var i=0, lenI=contents.length; i + + + + + + + + + + + + + +
+ + diff --git a/tests/lib/GeoExt/data/WCSCapabilitiesReader.js b/tests/lib/GeoExt/data/WCSCapabilitiesReader.js new file mode 100644 index 00000000..6c6b2435 --- /dev/null +++ b/tests/lib/GeoExt/data/WCSCapabilitiesReader.js @@ -0,0 +1,198 @@ +var doc = (new OpenLayers.Format.XML).read( +'' + +'' + + '' + + 'Web-Service Demo with data stored at TUDOR site' + + 'This installation serves different Web-Service types (WMS, WFS) for testing' + + '' + + 'Geospatial WebServices' + + 'Keyword One' + + 'Keyword Two!!' + + '' + + 'OGC WCS' + + '1.1.0' + + 'No fee!' + + 'Unconstrained!' + + '' + + '' + + 'CRP Henri Tudor' + + '' + + '' + + 'Roy Dumerde' + + 'R+D engineer' + + '' + + '' + + '6463320' + + '6465955' + + '' + + '' + + '66, rue de Luxembourg' + + 'Esch-sur-Alzette' + + '' + + '97202' + + 'Luxembourg' + + 'flappy@tutones.com' + + '' + + '' + + '24/7' + + 'by phone' + + '' + + 'GIS-Analyst' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + 'WCS' + + '' + + '' + + '' + + '' + + '1.1.0' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + 'WCS' + + '' + + '' + + '' + + '' + + '1.1.0' + + '' + + '' + + '' + + '' + + 'ro_dsm' + + 'ro_dsm_mini' + + 'ro_irra' + + 'ro_irra_ext' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + 'WCS' + + '' + + '' + + '' + + '' + + '1.1.0' + + '' + + '' + + '' + + '' + + 'ro_dsm' + + 'ro_dsm_mini' + + 'ro_irra' + + 'ro_irra_ext' + + '' + + '' + + '' + + '' + + 'NEAREST_NEIGHBOUR' + + 'BILINEAR' + + '' + + '' + + '' + + '' + + 'image/tiff' + + 'image/png' + + 'image/jpeg' + + 'image/gif' + + 'image/png; mode=8bit' + + '' + + '' + + '' + + '' + + 'false' + + '' + + '' + + '' + + '' + + 'urn:ogc:def:crs:epsg::4326' + + '' + + '' + + '' + + '' + + '' + + '' + + 'Rotterdam DSM' + + 'Digital Surface Model (DSM) raster data set of inner city Rotterdam' + + '' + + '4.471333734139 51.912813427383' + + '4.4808508475645 51.9248713705576' + + '' + + 'urn:ogc:def:crs:EPSG::28992' + + 'urn:ogc:def:crs:EPSG::900913' + + 'urn:ogc:def:crs:EPSG::3857' + + 'urn:ogc:def:crs:EPSG::4326' + + 'image/tiff' + + 'ro_dsm' + + '' + + '' + + 'Rotterdam sample DSM subset' + + 'This a test data set of Rotterdams DSM subset' + + '' + + '4.47489346945755 51.9159453786927' + + '4.47687824892444 51.9170706688033' + + '' + + 'urn:ogc:def:crs:EPSG::28992' + + 'urn:ogc:def:crs:EPSG::900913' + + 'urn:ogc:def:crs:EPSG::3857' + + 'urn:ogc:def:crs:EPSG::4326' + + 'image/tiff' + + 'ro_dsm_mini' + + '' + + '' + + 'Rotterdam (Ljinbaan) solar irradiation data 2010' + + 'This a result data set of a solar computation of Ljinbaan area. It shows the sum of kWh/a per sqmeter for 2010' + + '' + + '4.471333734139 51.912813427383' + + '4.4808508475645 51.9248713705576' + + '' + + 'urn:ogc:def:crs:EPSG::28992' + + 'urn:ogc:def:crs:EPSG::900913' + + 'urn:ogc:def:crs:EPSG::3857' + + 'urn:ogc:def:crs:EPSG::4326' + + 'image/tiff' + + 'ro_irra' + + '' + + '' + + 'Rotterdam (extended) solar irradiation data 2010' + + 'This a result data set of a solar computation of extended Rotterdam area. It shows the sum of kWh/a per sqmeter for 2010' + + '' + + '4.10024171314823 51.9359764992844' + + '4.21909054278063 52.001415228243' + + '' + + 'urn:ogc:def:crs:EPSG::28992' + + 'urn:ogc:def:crs:EPSG::900913' + + 'urn:ogc:def:crs:EPSG::3857' + + 'urn:ogc:def:crs:EPSG::4326' + + 'image/tiff' + + 'ro_irra_ext' + + '' + + '' + +'' ); From 5e977c1e61cfce3483fe0e86820a0cbe9a5851dd Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Mon, 7 Jan 2013 13:39:03 +0100 Subject: [PATCH 02/10] More early stage wcs support --- lib/GeoExt.js | 1 + lib/GeoExt/data/WFSCapabilitiesReader.js | 2 ++ tests/lib/GeoExt/data/WFSCapabilitiesReader.html | 2 +- tests/list-tests.html | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/GeoExt.js b/lib/GeoExt.js index 64ff68f2..47042b78 100644 --- a/lib/GeoExt.js +++ b/lib/GeoExt.js @@ -79,6 +79,7 @@ "GeoExt/data/WFSCapabilitiesReader.js", "GeoExt/data/WFSCapabilitiesStore.js", "GeoExt/data/WMSDescribeLayerReader.js", + "GeoExt/data/WCSCapabilitiesReader.js", "GeoExt/data/WMSDescribeLayerStore.js", "GeoExt/data/WMCReader.js", "GeoExt/data/CSWRecordsReader.js", diff --git a/lib/GeoExt/data/WFSCapabilitiesReader.js b/lib/GeoExt/data/WFSCapabilitiesReader.js index 3fc829ff..1cc0b1fd 100644 --- a/lib/GeoExt/data/WFSCapabilitiesReader.js +++ b/lib/GeoExt/data/WFSCapabilitiesReader.js @@ -95,6 +95,8 @@ Ext.extend(GeoExt.data.WFSCapabilitiesReader, Ext.data.DataReader, { var featureTypes = data.featureTypeList.featureTypes; var fields = this.recordType.prototype.fields; + debugger + var featureType, values, field, v, parts, layer; var layerOptions, protocolOptions; diff --git a/tests/lib/GeoExt/data/WFSCapabilitiesReader.html b/tests/lib/GeoExt/data/WFSCapabilitiesReader.html index def550e2..63e6809b 100644 --- a/tests/lib/GeoExt/data/WFSCapabilitiesReader.html +++ b/tests/lib/GeoExt/data/WFSCapabilitiesReader.html @@ -54,7 +54,7 @@ "[0] correct layer abstract" ); - //3 tests -- Testing the layer field (and its default protocol) + // 4 tests -- Testing the layer field (and its default protocol) var layer = record.getLayer(); t.eq(layer.CLASS_NAME, "OpenLayers.Layer.Vector", "[0] layer field is of type OpenLayers.Layer.Vector"); t.eq(layer.protocol.CLASS_NAME, "OpenLayers.Protocol.WFS.v1_0_0", "[0] protocol is of type OpenLayers.Protocol.WFS.v1_0_0"); diff --git a/tests/list-tests.html b/tests/list-tests.html index 721ab85a..aca397c4 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -14,6 +14,7 @@
  • lib/GeoExt/data/ProtocolProxy.html
  • lib/GeoExt/data/StyleReader.html
  • lib/GeoExt/data/WFSCapabilitiesReader.html
  • +
  • lib/GeoExt/data/WCSCapabilitiesReader.html
  • lib/GeoExt/data/WMSCapabilitiesReader.html
  • lib/GeoExt/data/WMSDescribeLayerReader.html
  • lib/GeoExt/data/WMCReader.html
  • From 06f0642fd5812a7105d80955b826c6d7014725e4 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Mon, 7 Jan 2013 14:23:34 +0100 Subject: [PATCH 03/10] Remove debugging statement --- lib/GeoExt/data/WFSCapabilitiesReader.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/GeoExt/data/WFSCapabilitiesReader.js b/lib/GeoExt/data/WFSCapabilitiesReader.js index 1cc0b1fd..3fc829ff 100644 --- a/lib/GeoExt/data/WFSCapabilitiesReader.js +++ b/lib/GeoExt/data/WFSCapabilitiesReader.js @@ -95,8 +95,6 @@ Ext.extend(GeoExt.data.WFSCapabilitiesReader, Ext.data.DataReader, { var featureTypes = data.featureTypeList.featureTypes; var fields = this.recordType.prototype.fields; - debugger - var featureType, values, field, v, parts, layer; var layerOptions, protocolOptions; From af1b95d00f134e86b7a3a3db8fecf89c44e9b3a8 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Mon, 7 Jan 2013 14:33:13 +0100 Subject: [PATCH 04/10] Add WCSCapabilitiesStore --- lib/GeoExt.js | 1 + lib/GeoExt/data/WCSCapabilitiesStore.js | 58 +++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 lib/GeoExt/data/WCSCapabilitiesStore.js diff --git a/lib/GeoExt.js b/lib/GeoExt.js index 47042b78..f883fe39 100644 --- a/lib/GeoExt.js +++ b/lib/GeoExt.js @@ -80,6 +80,7 @@ "GeoExt/data/WFSCapabilitiesStore.js", "GeoExt/data/WMSDescribeLayerReader.js", "GeoExt/data/WCSCapabilitiesReader.js", + "GeoExt/data/WCSCapabilitiesStore.js", "GeoExt/data/WMSDescribeLayerStore.js", "GeoExt/data/WMCReader.js", "GeoExt/data/CSWRecordsReader.js", diff --git a/lib/GeoExt/data/WCSCapabilitiesStore.js b/lib/GeoExt/data/WCSCapabilitiesStore.js new file mode 100644 index 00000000..4efd8b67 --- /dev/null +++ b/lib/GeoExt/data/WCSCapabilitiesStore.js @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2008-2012 The Open Source Geospatial Foundation + * + * Published under the BSD license. + * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text + * of the license. + */ + +/** + * @include GeoExt/data/WCSCapabilitiesReader.js + */ + +/** api: (define) + * module = GeoExt.data + * class = WCSCapabilitiesStore + * base_link = `Ext.data.Store `_ + */ +Ext.namespace("GeoExt.data"); + +/** api: constructor + * .. class:: WCSCapabilitiesStore + * + * Small helper class to make creating stores for remote WCS metadata + * easier. The store is pre-configured with a built-in + * ``Ext.data.HttpProxy`` and :class:`GeoExt.data.WCSCapabilitiesReader`. + * The proxy is configured to allow caching and issues requests via GET. + */ + +/** api: config[format] + * ``OpenLayers.Format`` + * A parser for transforming the XHR response into an array of objects + * representing attributes. Defaults to an ``OpenLayers.Format.WCSCapabilities`` + * parser. + */ + +/** api: config[fields] + * ``Array | Function`` + * Either an Array of field definition objects as passed to + * ``Ext.data.Record.create``, or a record constructor created using + * ``Ext.data.Record.create``. Defaults to ``["name", "type"]``. + */ + +GeoExt.data.WCSCapabilitiesStore = function(c) { + c = c || {}; + GeoExt.data.WCSCapabilitiesStore.superclass.constructor.call( + this, + Ext.apply(c, { + proxy: c.proxy || (!c.data ? + new Ext.data.HttpProxy({url: c.url, disableCaching: false, method: "GET"}) : + undefined + ), + reader: new GeoExt.data.WCSCapabilitiesReader( + c, c.fields + ) + }) + ); +}; +Ext.extend(GeoExt.data.WCSCapabilitiesStore, Ext.data.Store); From 88f0548974cb5725e6ddf0c7412275e84979c463 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Tue, 8 Jan 2013 10:31:34 +0100 Subject: [PATCH 05/10] Finalize (hopefully) WCSCapabilitiesReader --- lib/GeoExt/data/WCSCapabilitiesReader.js | 11 +- .../GeoExt/data/WCSCapabilitiesReader.html | 27 +++- .../lib/GeoExt/data/WCSCapabilitiesReader.js | 127 +++++++++++++++++- 3 files changed, 152 insertions(+), 13 deletions(-) diff --git a/lib/GeoExt/data/WCSCapabilitiesReader.js b/lib/GeoExt/data/WCSCapabilitiesReader.js index ff889a96..f8701cfd 100644 --- a/lib/GeoExt/data/WCSCapabilitiesReader.js +++ b/lib/GeoExt/data/WCSCapabilitiesReader.js @@ -41,13 +41,12 @@ GeoExt.data.WCSCapabilitiesReader = function(meta, recordType) { if(!(typeof recordType === "function")) { fields = recordType || meta.fields || [ {name: "title", type: "string"}, - {name: "namespace", type: "string", mapping: "featureNS"}, {name: "abstract", type: "string"} ]; // Make sure we always have an identifier attribute; // this will be needed by readRecords. - fields.push({name: "identifier", type: "string"}); // same as WFS "name" + fields.push({name: "identifier", type: "string"}); recordType = Ext.data.Record.create(fields); } @@ -93,13 +92,13 @@ Ext.extend(GeoExt.data.WCSCapabilitiesReader, Ext.data.DataReader, { var coverageSummary, values, field, v; - - var records = []; for(var i=0, lenI=contents.length; i - + + + + + + + + + + + +
    + + diff --git a/tests/lib/GeoExt/data/WCSDescribeCoverageReader.js b/tests/lib/GeoExt/data/WCSDescribeCoverageReader.js new file mode 100644 index 00000000..867fb6ef --- /dev/null +++ b/tests/lib/GeoExt/data/WCSDescribeCoverageReader.js @@ -0,0 +1,435 @@ +// MapServer, v1.0.0 +var doc100 = (new OpenLayers.Format.XML).read( +'' + +'' + + '' + + 'ro_dsm' + + '' + + '' + + '4.471333734139 51.912813427383' + + '4.4808508475645 51.9248713705576' + + '' + + '' + + '' + + '' + + '4.471333734139 51.912813427383' + + '4.4808508475645 51.9248713705576' + + '' + + '' + + '91979 437659.5' + + '92617 436326' + + '' + + '' + + '' + + '' + + '0 0' + + '1275 2666' + + '' + + '' + + 'x' + + 'y' + + '' + + '91979 437659.5' + + '' + + '0.5 0' + + '0 -0.5' + + '' + + '' + + '' + + '' + + '' + + 'Range 1' + + '' + + '' + + '' + + '' + + 'EPSG:28992' + + 'EPSG:900913' + + 'EPSG:3857' + + 'EPSG:4326' + + 'EPSG:28992' + + '' + + '' + + 'GTiff' + + '' + + '' + + 'nearest neighbor' + + 'bilinear' + + '' + + '' + + '' + + 'ro_dsm_mini' + + '' + + '' + + '4.47489346945755 51.9159453786927' + + '4.47687824892444 51.9170706688033' + + '' + + '' + + '' + + '' + + '4.47489346945755 51.9159453786927' + + '4.47687824892444 51.9170706688033' + + '' + + '' + + '92213 436671.5' + + '92348 436795' + + '' + + '' + + '' + + '' + + '0 0' + + '269 246' + + '' + + '' + + 'x' + + 'y' + + '' + + '92213 436795' + + '' + + '0.5 0' + + '0 -0.5' + + '' + + '' + + '' + + '' + + '' + + 'Range 1' + + '' + + '' + + '' + + '' + + 'EPSG:28992' + + 'EPSG:900913' + + 'EPSG:3857' + + 'EPSG:4326' + + 'EPSG:28992' + + '' + + '' + + 'GTiff' + + '' + + '' + + 'nearest neighbor' + + 'bilinear' + + '' + + '' + + '' + + 'ro_irra' + + '' + + '' + + '4.471333734139 51.912813427383' + + '4.4808508475645 51.9248713705576' + + '' + + '' + + '' + + '' + + '4.471333734139 51.912813427383' + + '4.4808508475645 51.9248713705576' + + '' + + '' + + '91979 437659.5' + + '92617 436326' + + '' + + '' + + '' + + '' + + '0 0' + + '1275 2666' + + '' + + '' + + 'x' + + 'y' + + '' + + '91979 437659.5' + + '' + + '0.5 0' + + '0 -0.5' + + '' + + '' + + '' + + '' + + '' + + 'Range 1' + + '' + + '' + + '' + + '' + + 'EPSG:28992' + + 'EPSG:900913' + + 'EPSG:3857' + + 'EPSG:4326' + + 'EPSG:28992' + + '' + + '' + + 'GTiff' + + '' + + '' + + 'nearest neighbor' + + 'bilinear' + + '' + + '' + + '' + + 'ro_irra_ext' + + '' + + '' + + '4.10024171314823 51.9359764992844' + + '4.21909054278063 52.001415228243' + + '' + + '' + + '' + + '' + + '4.10024171314823 51.9359764992844' + + '4.21909054278063 52.001415228243' + + '' + + '' + + '66606.5 439287.5' + + '74653.5 446432.5' + + '' + + '' + + '' + + '' + + '0 0' + + '16093 14289' + + '' + + '' + + 'x' + + 'y' + + '' + + '66606.5 446432.5' + + '' + + '0.5 0' + + '0 -0.5' + + '' + + '' + + '' + + '' + + '' + + 'Range 1' + + '' + + '' + + '' + + '' + + 'EPSG:28992' + + 'EPSG:900913' + + 'EPSG:3857' + + 'EPSG:4326' + + 'EPSG:28992' + + '' + + '' + + 'GTiff' + + '' + + '' + + 'nearest neighbor' + + 'bilinear' + + '' + + '' + +''); + + +var doc110 = (new OpenLayers.Format.XML).read( +'' + +'' + + '' + + 'RO DSM' + + 'Digital Surface Model (DSM) raster data set of inner city Rotterdam' + + 'ro_dsm' + + '' + + '' + + '' + + '0 0' + + '1275 2666' + + '' + + '' + + '91979 437659.5' + + '92617 436326' + + '' + + '' + + '4.471333734139 51.912813427383' + + '4.4808508475645 51.9248713705576' + + '' + + '' + + 'urn:ogc:def:crs:EPSG::28992' + + 'urn:ogc:def:method:WCS:1.1:2dSimpleGrid' + + '91979.25 437659.25' + + '0.5 -0.5' + + 'urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS' + + '' + + '' + + '' + + '' + + '' + + 'My Label' + + 'Range 1' + + '' + + '' + + '' + + '' + + 'bilinear' + + 'nearest neighbor' + + '' + + '' + + '' + + '1' + + '' + + '' + + '' + + '' + + 'urn:ogc:def:crs:EPSG::28992' + + 'urn:ogc:def:crs:EPSG::900913' + + 'urn:ogc:def:crs:EPSG::3857' + + 'urn:ogc:def:crs:EPSG::4326' + + 'image/tiff' + + '' + + '' + + 'ro_dsm_mini' + + 'This a test data set of Rotterdams DSM subset' + + 'ro_dsm_mini' + + '' + + '' + + '' + + '0 0' + + '269 246' + + '' + + '' + + '92213 436671.5' + + '92348 436795' + + '' + + '' + + '4.47489346945755 51.9159453786927' + + '4.47687824892444 51.9170706688033' + + '' + + '' + + 'urn:ogc:def:crs:EPSG::28992' + + 'urn:ogc:def:method:WCS:1.1:2dSimpleGrid' + + '92213.25 436794.75' + + '0.5 -0.5' + + 'urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS' + + '' + + '' + + '' + + '' + + '' + + 'My Label' + + 'Range 1' + + '' + + '' + + '' + + '' + + 'bilinear' + + 'nearest neighbor' + + '' + + '' + + '' + + '1' + + '' + + '' + + '' + + '' + + 'urn:ogc:def:crs:EPSG::28992' + + 'urn:ogc:def:crs:EPSG::900913' + + 'urn:ogc:def:crs:EPSG::3857' + + 'urn:ogc:def:crs:EPSG::4326' + + 'image/tiff' + + '' + + '' + + 'ro_irra' + + 'This a result data set of a solar computation of Ljinbaan area. It shows the sum of kWh/a per sqmeter for 2010' + + 'ro_irra' + + '' + + '' + + '' + + '0 0' + + '1275 2666' + + '' + + '' + + '91979 437659.5' + + '92617 436326' + + '' + + '' + + '4.471333734139 51.912813427383' + + '4.4808508475645 51.9248713705576' + + '' + + '' + + 'urn:ogc:def:crs:EPSG::28992' + + 'urn:ogc:def:method:WCS:1.1:2dSimpleGrid' + + '91979.25 437659.25' + + '0.5 -0.5' + + 'urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS' + + '' + + '' + + '' + + '' + + '' + + 'My Label' + + 'Range 1' + + '' + + '' + + '' + + '' + + 'bilinear' + + 'nearest neighbor' + + '' + + '' + + '' + + '1' + + '' + + '' + + '' + + '' + + 'urn:ogc:def:crs:EPSG::28992' + + 'urn:ogc:def:crs:EPSG::900913' + + 'urn:ogc:def:crs:EPSG::3857' + + 'urn:ogc:def:crs:EPSG::4326' + + 'image/tiff' + + '' + + '' + + 'ro_irra_ext' + + 'This a result data set of a solar computation of extended Rotterdam area. It shows the sum of kWh/a per sqmeter for 2010' + + 'ro_irra_ext' + + '' + + '' + + '' + + '0 0' + + '16093 14289' + + '' + + '' + + '66606.5 439287.5' + + '74653.5 446432.5' + + '' + + '' + + '4.10024171314823 51.9359764992844' + + '4.21909054278063 52.001415228243' + + '' + + '' + + 'urn:ogc:def:crs:EPSG::28992' + + 'urn:ogc:def:method:WCS:1.1:2dSimpleGrid' + + '66606.75 446432.25' + + '0.5 -0.5' + + 'urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS' + + '' + + '' + + '' + + '' + + '' + + 'My Label' + + 'Range 1' + + '' + + '' + + '' + + '' + + 'bilinear' + + 'nearest neighbor' + + '' + + '' + + '' + + '1' + + '' + + '' + + '' + + '' + + 'urn:ogc:def:crs:EPSG::28992' + + 'urn:ogc:def:crs:EPSG::900913' + + 'urn:ogc:def:crs:EPSG::3857' + + 'urn:ogc:def:crs:EPSG::4326' + + 'image/tiff' + + '' + +''); From 9857cf63d7222b8061c8bc468051629c09fc669b Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Tue, 5 Feb 2013 13:19:45 +0100 Subject: [PATCH 10/10] Deepen support for GetCoverage --- lib/GeoExt.js | 2 ++ lib/GeoExt/data/WCSDescribeCoverageReader.js | 8 ++++++-- tests/lib/GeoExt/data/WCSDescribeCoverageReader.html | 9 ++++++--- tests/list-tests.html | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/GeoExt.js b/lib/GeoExt.js index f883fe39..73062083 100644 --- a/lib/GeoExt.js +++ b/lib/GeoExt.js @@ -81,6 +81,8 @@ "GeoExt/data/WMSDescribeLayerReader.js", "GeoExt/data/WCSCapabilitiesReader.js", "GeoExt/data/WCSCapabilitiesStore.js", + "GeoExt/data/WCSDescribeCoverageReader.js", + "GeoExt/data/WCSDescribeCoverageStore.js", "GeoExt/data/WMSDescribeLayerStore.js", "GeoExt/data/WMCReader.js", "GeoExt/data/CSWRecordsReader.js", diff --git a/lib/GeoExt/data/WCSDescribeCoverageReader.js b/lib/GeoExt/data/WCSDescribeCoverageReader.js index 0e607159..27d66bf2 100644 --- a/lib/GeoExt/data/WCSDescribeCoverageReader.js +++ b/lib/GeoExt/data/WCSDescribeCoverageReader.js @@ -43,10 +43,14 @@ GeoExt.data.WCSDescribeCoverageReader = function(meta, recordType) { {name: "title", type: "string"}, {name: "nativeCRS", type: "string"}, {name: "nativeBoundingBox", mapping: function(data) { - return data.domain.spatialDomain.boundingBoxes[data.nativeCRS]; + return data.domain.spatialDomain.boundingBoxes[data.nativeCRS]; }}, {name: "supportedCRSs"}, // array - {name: "supportedFormats"} // array + {name: "supportedFormats"}, // array + {name: "gridOffsets", mapping: function(data) { + return data.domain.spatialDomain.gridCRS && + data.domain.spatialDomain.gridCRS.gridOffsets || undefined; + }} ]; // Make sure we always have an name attribute; diff --git a/tests/lib/GeoExt/data/WCSDescribeCoverageReader.html b/tests/lib/GeoExt/data/WCSDescribeCoverageReader.html index 3886dd1d..35fdad09 100644 --- a/tests/lib/GeoExt/data/WCSDescribeCoverageReader.html +++ b/tests/lib/GeoExt/data/WCSDescribeCoverageReader.html @@ -19,7 +19,7 @@ var fields = reader.recordType.prototype.fields; // 1 test // Test the default items enumerated in GeoExt.data.WCSDescribeCoverageReader constructor - t.eq(fields.items.length, 6, 'number of default items is correct'); + t.eq(fields.items.length, 7, 'number of default items is correct'); var reader = new GeoExt.data.WCSDescribeCoverageReader({},[ {name: 'foo'}, @@ -35,7 +35,7 @@ } function test_read_1_0_0(t) { - t.plan(10); + t.plan(11); var reader = new GeoExt.data.WCSDescribeCoverageReader(); @@ -56,10 +56,11 @@ t.eq(record.data.supportedCRSs[1], 'EPSG:900913', 'correct supportedCRS value'); t.eq(record.data.supportedFormats.length, 1, 'correct number of supportedFormats'); t.eq(record.data.supportedFormats[0], 'GTiff', 'correct supportedFormat value'); + t.eq(record.data.gridOffsets, undefined, 'correct gridOffsets'); // Not supported in 1.0.0 } function test_read_1_1_0(t) { - t.plan(10); + t.plan(12); var reader = new GeoExt.data.WCSDescribeCoverageReader(); @@ -80,6 +81,8 @@ t.eq(record.data.supportedCRSs[1], 'urn:ogc:def:crs:EPSG::900913', 'correct supportedCRS value'); t.eq(record.data.supportedFormats.length, 1, 'correct number of supportedFormats'); t.eq(record.data.supportedFormats[0], 'image/tiff', 'correct supportedFormat value'); + t.eq(record.data.gridOffsets.x, 0.5, 'correct gridOffsets.x'); + t.eq(record.data.gridOffsets.y, -0.5, 'correct gridOffsets.y'); } diff --git a/tests/list-tests.html b/tests/list-tests.html index aca397c4..b6b1e230 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -15,6 +15,7 @@
  • lib/GeoExt/data/StyleReader.html
  • lib/GeoExt/data/WFSCapabilitiesReader.html
  • lib/GeoExt/data/WCSCapabilitiesReader.html
  • +
  • lib/GeoExt/data/WCSDescribeCoverageReader.html
  • lib/GeoExt/data/WMSCapabilitiesReader.html
  • lib/GeoExt/data/WMSDescribeLayerReader.html
  • lib/GeoExt/data/WMCReader.html