From 6c5119455d52cb266bf3c463004522ca448407f8 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 19 Dec 2012 18:11:14 +0100 Subject: [PATCH 01/50] Basic WCS testing in place. Tests are basically meaningless at this point. --- lib/OpenLayers.js | 8 ++++++++ tests/list-tests.html | 2 ++ 2 files changed, 10 insertions(+) diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index 4df00ddf62..711ab6606c 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -280,6 +280,10 @@ "OpenLayers/Filter/Function.js", "OpenLayers/Protocol.js", "OpenLayers/Protocol/HTTP.js", + "OpenLayers/Protocol/WCS.js", + "OpenLayers/Protocol/WCS/v1.js", + "OpenLayers/Protocol/WCS/v1_0_0.js", + "OpenLayers/Protocol/WCS/v1_1_0.js", "OpenLayers/Protocol/WFS.js", "OpenLayers/Protocol/WFS/v1.js", "OpenLayers/Protocol/WFS/v1_0_0.js", @@ -313,6 +317,10 @@ "OpenLayers/Format/OWSCommon/v1.js", "OpenLayers/Format/OWSCommon/v1_0_0.js", "OpenLayers/Format/OWSCommon/v1_1_0.js", + "OpenLayers/Format/WCSCapabilities.js", + "OpenLayers/Format/WCSCapabilities/v1.js", + "OpenLayers/Format/WCSCapabilities/v1_0_0.js", + "OpenLayers/Format/WCSCapabilities/v1_1_0.js", "OpenLayers/Format/WFSCapabilities.js", "OpenLayers/Format/WFSCapabilities/v1.js", "OpenLayers/Format/WFSCapabilities/v1_0_0.js", diff --git a/tests/list-tests.html b/tests/list-tests.html index 8c37464b84..3b24400fa3 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -84,6 +84,8 @@
  • Format/Filter/v1_0_0.html
  • Format/Filter/v1_1_0.html
  • Format/QueryStringFilter.html
  • +
  • Format/WCSCapabilities.html
  • +
  • Format/WCSCapabilities/v1.html
  • Format/WFS.html
  • Format/WFSCapabilities.html
  • Format/WFSCapabilities/v1.html
  • From 5c07ae47bb13f56ea560f522f60b65d651ef9488 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Fri, 21 Dec 2012 13:15:01 +0100 Subject: [PATCH 02/50] WCS testing more-or-less working, many tests failing, as expected --- lib/OpenLayers/Format/WCSCapabilities.js | 56 +++ lib/OpenLayers/Format/WCSCapabilities/v1.js | 108 +++++ .../Format/WCSCapabilities/v1_0_0.js | 115 +++++ .../Format/WCSCapabilities/v1_1_0.js | 99 ++++ lib/OpenLayers/Protocol/WCS.js | 86 ++++ lib/OpenLayers/Protocol/WCS/v1.js | 434 ++++++++++++++++++ lib/OpenLayers/Protocol/WCS/v1_0_0.js | 43 ++ lib/OpenLayers/Protocol/WCS/v1_1_0.js | 37 ++ tests/Format/WCSCapabilities.html | 43 ++ tests/Format/WCSCapabilities/v1.html | 181 ++++++++ 10 files changed, 1202 insertions(+) create mode 100644 lib/OpenLayers/Format/WCSCapabilities.js create mode 100644 lib/OpenLayers/Format/WCSCapabilities/v1.js create mode 100644 lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js create mode 100644 lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js create mode 100644 lib/OpenLayers/Protocol/WCS.js create mode 100644 lib/OpenLayers/Protocol/WCS/v1.js create mode 100644 lib/OpenLayers/Protocol/WCS/v1_0_0.js create mode 100644 lib/OpenLayers/Protocol/WCS/v1_1_0.js create mode 100644 tests/Format/WCSCapabilities.html create mode 100644 tests/Format/WCSCapabilities/v1.html diff --git a/lib/OpenLayers/Format/WCSCapabilities.js b/lib/OpenLayers/Format/WCSCapabilities.js new file mode 100644 index 0000000000..ae034a5227 --- /dev/null +++ b/lib/OpenLayers/Format/WCSCapabilities.js @@ -0,0 +1,56 @@ +/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the 2-clause BSD license. + * See license.txt in the OpenLayers distribution or repository for the + * full text of the license. */ + +/** + * @requires OpenLayers/Format/XML/VersionedOGC.js + */ + +/** + * Class: OpenLayers.Format.WCSCapabilities + * Read WCS Capabilities. + * + * Inherits from: + * - + */ +OpenLayers.Format.WCSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC, { + + /** + * APIProperty: defaultVersion + * {String} Version number to assume if none found. Default is "1.1.0". + */ + defaultVersion: "1.1.0", + + /** + * APIProperty: errorProperty + * {String} Which property of the returned object to check for in order to + * determine whether or not parsing has failed. In the case that the + * errorProperty is undefined on the returned object, the document will be + * run through an OGCExceptionReport parser. + */ + errorProperty: "service", + + /** + * Constructor: OpenLayers.Format.WCSCapabilities + * Create a new parser for WCS capabilities. + * + * Parameters: + * options - {Object} An optional object whose properties will be set on + * this instance. + */ + + /** + * APIMethod: read + * Read capabilities data from a string, and return a list of layers. + * + * Parameters: + * data - {String} or {DOMElement} data to read/parse. + * + * Returns: + * {Array} List of named layers. + */ + + CLASS_NAME: "OpenLayers.Format.WCSCapabilities" + +}); diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1.js b/lib/OpenLayers/Format/WCSCapabilities/v1.js new file mode 100644 index 0000000000..47aa0b9411 --- /dev/null +++ b/lib/OpenLayers/Format/WCSCapabilities/v1.js @@ -0,0 +1,108 @@ +/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the 2-clause BSD license. + * See license.txt in the OpenLayers distribution or repository for the + * full text of the license. */ + +/** + * @requires OpenLayers/Format/WCSCapabilities.js + */ + +/** + * Class: OpenLayers.Format.WCSCapabilities.v1 + * Abstract class not to be instantiated directly. + * + * Inherits from: + * - + */ +OpenLayers.Format.WCSCapabilities.v1 = OpenLayers.Class( + OpenLayers.Format.XML, { + + /** + * Property: namespaces + * {Object} Mapping of namespace aliases to namespace URIs. + */ + namespaces: { + wcs: "http://www.opengis.net/wcs", + xlink: "http://www.w3.org/1999/xlink", + xsi: "http://www.w3.org/2001/XMLSchema-instance", + ows: "http://www.opengis.net/ows" + }, + + /** + * Property: defaultPrefix + */ + defaultPrefix: "wcs", + + /** + * Constructor: OpenLayers.Format.WCSCapabilities.v1_1 + * Create an instance of one of the subclasses. + * + * Parameters: + * options - {Object} An optional object whose properties will be set on + * this instance. + */ + + /** + * APIMethod: read + * Read capabilities data from a string, and return a list of layers. + * + * Parameters: + * data - {String} or {DOMElement} data to read/parse. + * + * Returns: + * {Array} List of named layers. + */ + read: function(data) { + if(typeof data == "string") { + data = OpenLayers.Format.XML.prototype.read.apply(this, [data]); + } + var raw = data; + if(data && data.nodeType == 9) { + data = data.documentElement; + } + var capabilities = {}; + this.readNode(data, capabilities); + return capabilities; + }, + + /** + * Property: readers + * Contains public functions, grouped by namespace prefix, that will + * be applied when a namespaced node is found matching the function + * name. The function will be applied in the scope of this parser + * with two arguments: the node being read and a context object passed + * from the parent. + */ + readers: { + "wcs": { + "WCS_Capabilities": function(node, obj) { // In 1.0.0, this was WCS_Capabilties, changed in 1.1.0 + this.readChildNodes(node, obj); + }, + "Name": function(node, obj) { //???? + var name = this.getChildValue(node); + if(name) { + var parts = name.split(":"); + obj.name = parts.pop(); + if(parts.length > 0) { + obj.featureNS = this.lookupNamespaceURI(node, parts[0]); + } + } + }, + "Title": function(node, obj) { + var title = this.getChildValue(node); + if(title) { + obj.title = title; + } + }, + "Abstract": function(node, obj) { + var abst = this.getChildValue(node); + if(abst) { + obj["abstract"] = abst; + } + } + } + }, + + CLASS_NAME: "OpenLayers.Format.WCSCapabilities.v1" + +}); \ No newline at end of file diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js new file mode 100644 index 0000000000..e5d0803b62 --- /dev/null +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -0,0 +1,115 @@ +/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the 2-clause BSD license. + * See license.txt in the OpenLayers distribution or repository for the + * full text of the license. */ + +/** + * @requires OpenLayers/Format/WCSCapabilities/v1.js + */ + +/** + * Class: OpenLayers.Format.WCSCapabilities/v1_0_0 + * Read WCS Capabilities version 1.0.0. + * + * Inherits from: + * - + */ +OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( + OpenLayers.Format.WCSCapabilities.v1, { + + /** + * Constructor: OpenLayers.Format.WCSCapabilities.v1_0_0 + * Create a new parser for WCS capabilities version 1.0.0. + * + * Parameters: + * options - {Object} An optional object whose properties will be set on + * this instance. + */ + + /** + * Property: readers + * Contains public functions, grouped by namespace prefix, that will + * be applied when a namespaced node is found matching the function + * name. The function will be applied in the scope of this parser + * with two arguments: the node being read and a context object passed + * from the parent. + */ + readers: { + "wcs": OpenLayers.Util.applyDefaults({ + "Service": function(node, capabilities) { + capabilities.service = {}; + this.readChildNodes(node, capabilities.service); + }, + "Fees": function(node, service) { + var fees = this.getChildValue(node); + if (fees && fees.toLowerCase() != "none") { + service.fees = fees; + } + }, + "AccessConstraints": function(node, service) { + var constraints = this.getChildValue(node); + if (constraints && constraints.toLowerCase() != "none") { + service.accessConstraints = constraints; + } + }, + "OnlineResource": function(node, service) { + var onlineResource = this.getChildValue(node); + if (onlineResource && onlineResource.toLowerCase() != "none") { + service.onlineResource = onlineResource; + } + }, + "Keywords": function(node, service) { + var keywords = this.getChildValue(node); + if (keywords && keywords.toLowerCase() != "none") { + service.keywords = keywords.split(', '); + } + }, + "Capability": function(node, capabilities) { + capabilities.capability = {}; + this.readChildNodes(node, capabilities.capability); + }, + "Request": function(node, obj) { + obj.request = {}; + this.readChildNodes(node, obj.request); + }, + "GetFeature": function(node, request) { + request.getfeature = { + href: {}, // DCPType + formats: [] // ResultFormat + }; + this.readChildNodes(node, request.getfeature); + }, + "ResultFormat": function(node, obj) { + var children = node.childNodes; + var childNode; + for(var i=0; i + */ +OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( + OpenLayers.Format.WCSCapabilities.v1, { + + /** + * Property: regExes + * Compiled regular expressions for manipulating strings. + */ + regExes: { + trimSpace: (/^\s*|\s*$/g), + removeSpace: (/\s*/g), + splitSpace: (/\s+/), + trimComma: (/\s*,\s*/g) + }, + + + errorProperty: "Contents", // <== Not sure if this is strictly required by standard... maybe better to set to NULL? + + + /** + * Constructor: OpenLayers.Format.WCSCapabilities.v1_1_0 + * Create a new parser for WCS capabilities version 1.1.0. + * + * Parameters: + * options - {Object} An optional object whose properties will be set on + * this instance. + */ + + /** + * Property: readers + * Contains public functions, grouped by namespace prefix, that will + * be applied when a namespaced node is found matching the function + * name. The function will be applied in the scope of this parser + * with two arguments: the node being read and a context object passed + * from the parent. + */ + readers: { + "wcs": OpenLayers.Util.applyDefaults({ + "Capabilities": function(node, obj) { // In 1.0.0, this was WCS_Capabilties, in 1.1.0, it's just Capabilities + this.readChildNodes(node, obj); + }, + + "Contents": function(node, request) { + request.featureTypeList = { + contents: [] + }; + this.readChildNodes(node, request.contents); + }, + + "CoverageSummary": function(node, request) { + request.featureTypeList = { + coverageSummary: [] + }; + this.readChildNodes(node, request.coverageSummary); + }, + + "Identifier": function(node, obj) { + obj.identifier = this.getChildValue(node); + }, + + "SupportedCRS": function(node, obj) { + var crs = this.getChildValue(node); + if(crs) { + if(!obj["supportedCRS"]) { + obj["supportedCRS"] = []; + } + obj["supportedCRS"].push(crs); + } + }, + + "DefaultSRS": function(node, obj) { + var defaultSRS = this.getChildValue(node); + if (defaultSRS) { + obj.srs = defaultSRS; + } + } + }, OpenLayers.Format.WCSCapabilities.v1.prototype.readers["wcs"]), + "ows": OpenLayers.Format.OWSCommon.v1.prototype.readers["ows"] + }, + + CLASS_NAME: "OpenLayers.Format.WCSCapabilities.v1_1_0" + +}); \ No newline at end of file diff --git a/lib/OpenLayers/Protocol/WCS.js b/lib/OpenLayers/Protocol/WCS.js new file mode 100644 index 0000000000..9520e3fbc0 --- /dev/null +++ b/lib/OpenLayers/Protocol/WCS.js @@ -0,0 +1,86 @@ +/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the 2-clause BSD license. + * See license.txt in the OpenLayers distribution or repository for the + * full text of the license. */ + +/** + * @requires OpenLayers/Protocol.js + */ + +/** + * Class: OpenLayers.Protocol.WCS + * Used to create a versioned WCS protocol. Default version is 1.0.0. + * + * Returns: + * {} A WCS protocol of the given version. + * + * Example: + * (code) + * var protocol = new OpenLayers.Protocol.WCS({ + * version: "1.1.0", + * url: "http://demo.opengeo.org/geoserver/wcs", + * featureType: "tasmania_roads", + * featureNS: "http://www.openplans.org/topp", + * geometryName: "the_geom" + * }); + * (end) + * + * See the protocols for specific WCS versions for more detail. + */ +OpenLayers.Protocol.WCS = function(options) { + options = OpenLayers.Util.applyDefaults( + options, OpenLayers.Protocol.WCS.DEFAULTS + ); + var cls = OpenLayers.Protocol.WCS["v"+options.version.replace(/\./g, "_")]; + if(!cls) { + throw "Unsupported WCS version: " + options.version; + } + return new cls(options); +}; + +/** + * Function: fromWMSLayer + * Convenience function to create a WCS protocol from a WMS layer. This makes + * the assumption that a WCS requests can be issued at the same URL as + * WMS requests and that a WCS featureType exists with the same name as the + * WMS layer. + * + * This function is designed to auto-configure , , + * and for WCS 1.1.0. Note that + * srsName matching with the WMS layer will not work with WCS 1.0.0. + * + * Parameters: + * layer - {} WMS layer that has a matching WCS + * FeatureType at the same server url with the same typename. + * options - {Object} Default properties to be set on the protocol. + * + * Returns: + * {} + */ +OpenLayers.Protocol.WCS.fromWMSLayer = function(layer, options) { + var typeName, featurePrefix; + var param = layer.params["LAYERS"]; + var parts = (OpenLayers.Util.isArray(param) ? param[0] : param).split(":"); + if(parts.length > 1) { + featurePrefix = parts[0]; + } + typeName = parts.pop(); + var protocolOptions = { + url: layer.url, + featureType: typeName, + featurePrefix: featurePrefix, + srsName: layer.projection && layer.projection.getCode() || + layer.map && layer.map.getProjectionObject().getCode(), + version: "1.1.0" + }; + return new OpenLayers.Protocol.WCS(OpenLayers.Util.applyDefaults( + options, protocolOptions + )); +}; + +/** + * Constant: OpenLayers.Protocol.WCS.DEFAULTS + */ +OpenLayers.Protocol.WCS.DEFAULTS = { + "version": "1.0.0" +}; \ No newline at end of file diff --git a/lib/OpenLayers/Protocol/WCS/v1.js b/lib/OpenLayers/Protocol/WCS/v1.js new file mode 100644 index 0000000000..894918461b --- /dev/null +++ b/lib/OpenLayers/Protocol/WCS/v1.js @@ -0,0 +1,434 @@ +/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the 2-clause BSD license. + * See license.txt in the OpenLayers distribution or repository for the + * full text of the license. */ + +/** + * @requires OpenLayers/Protocol/WCS.js + */ + +/** + * Class: OpenLayers.Protocol.WCS.v1 + * Abstract class for for v1.0.0 and v1.1.0 protocol. + * + * Inherits from: + * - + */ +OpenLayers.Protocol.WCS.v1 = OpenLayers.Class(OpenLayers.Protocol, { + + /** + * Property: version + * {String} WCS version number. + */ + version: null, + + /** + * Property: srsName + * {String} Name of spatial reference system. Default is "EPSG:4326". + */ + srsName: "EPSG:4326", + + /** + * Property: featureType + * {String} Local feature typeName. + */ + featureType: null, + + /** + * Property: featureNS + * {String} Feature namespace. + */ + featureNS: null, + + /** + * Property: geometryName + * {String} Name of the geometry attribute for features. Default is + * "the_geom" for WCS 1.0, and null for higher versions. + */ + geometryName: "the_geom", + + /** + * Property: schema + * {String} Optional schema location that will be included in the + * schemaLocation attribute value. Note that the feature type schema + * is required for a strict XML validator (on transactions with an + * insert for example), but is *not* required by the WCS specification + * (since the server is supposed to know about feature type schemas). + */ + schema: null, + + /** + * Property: featurePrefix + * {String} Namespace alias for feature type. Default is "feature". + */ + featurePrefix: "feature", + + /** + * Property: formatOptions + * {Object} Optional options for the format. If a format is not provided, + * this property can be used to extend the default format options. + */ + formatOptions: null, + + /** + * Property: readFormat + */ + readFormat: null, + + /** + * Property: readOptions + * {Object} Optional object to pass to format's read. + */ + readOptions: null, + + /** + * Constructor: OpenLayers.Protocol.WCS + * A class for giving layers WCS protocol. + * + * Parameters: + * options - {Object} Optional object whose properties will be set on the + * instance. + * + * Valid options properties: + * url - {String} URL to send requests to (required). + * featureType - {String} Local (without prefix) feature typeName (required). + * featureNS - {String} Feature namespace (required, but can be autodetected + * during the first query if GML is used as readFormat and + * featurePrefix is provided and matches the prefix used by the server + * for this featureType). + * featurePrefix - {String} Feature namespace alias (optional - only used + * for writing if featureNS is provided). Default is 'feature'. + * geometryName - {String} Name of geometry attribute. The default is + * 'the_geom' for WCS 1.0, and null for higher versions. If + * null, it will be set to the name of the first geometry found in the + * first read operation. + * multi - {Boolean} If set to true, geometries will be casted to Multi + * geometries before they are written in a transaction. No casting will + * be done when reading features. + */ + initialize: function(options) { + OpenLayers.Protocol.prototype.initialize.apply(this, [options]); + + if (!options.geometryName && parseFloat(this.format.version) > 1.0) { + this.setGeometryName(null); + } + }, + + /** + * APIMethod: destroy + * Clean up the protocol. + */ + destroy: function() { + if(this.options && !this.options.format) { + this.format.destroy(); + } + this.format = null; + OpenLayers.Protocol.prototype.destroy.apply(this); + }, + + /** + * APIMethod: read + * Construct a request for reading new features. Since WCS splits the + * basic CRUD operations into GetFeature requests (for read) and + * Transactions (for all others), this method does not make use of the + * format's read method (that is only about reading transaction + * responses). + * + * Parameters: + * options - {Object} Options for the read operation, in addition to the + * options set on the instance (options set here will take precedence). + * + * To use a configured protocol to get e.g. a WCS hit count, applications + * could do the following: + * + * (code) + * protocol.read({ + * readOptions: {output: "object"}, + * resultType: "hits", + * maxFeatures: null, + * callback: function(resp) { + * // process resp.numberOfFeatures here + * } + * }); + * (end) + * + * To use a configured protocol to use WCS paging (if supported by the + * server), applications could do the following: + * + * (code) + * protocol.read({ + * startIndex: 0, + * count: 50 + * }); + * (end) + * + * To limit the attributes returned by the GetFeature request, applications + * can use the propertyNames option to specify the properties to include in + * the response: + * + * (code) + * protocol.read({ + * propertyNames: ["DURATION", "INTENSITY"] + * }); + * (end) + */ + read: function(options) { + OpenLayers.Protocol.prototype.read.apply(this, arguments); + options = OpenLayers.Util.extend({}, options); + OpenLayers.Util.applyDefaults(options, this.options || {}); + var response = new OpenLayers.Protocol.Response({requestType: "read"}); + + var data = OpenLayers.Format.XML.prototype.write.apply( + this.format, [this.format.writeNode("wcs:GetFeature", options)] + ); + + response.priv = OpenLayers.Request.POST({ + url: options.url, + callback: this.createCallback(this.handleRead, response, options), + params: options.params, + headers: options.headers, + data: data + }); + + return response; + }, + + /** + * APIMethod: setFeatureType + * Change the feature type on the fly. + * + * Parameters: + * featureType - {String} Local (without prefix) feature typeName. + */ + setFeatureType: function(featureType) { + this.featureType = featureType; + this.format.featureType = featureType; + }, + + /** + * APIMethod: setGeometryName + * Sets the geometryName option after instantiation. + * + * Parameters: + * geometryName - {String} Name of geometry attribute. + */ + setGeometryName: function(geometryName) { + this.geometryName = geometryName; + this.format.geometryName = geometryName; + }, + + /** + * Method: handleRead + * Deal with response from the read request. + * + * Parameters: + * response - {} The response object to pass + * to the user callback. + * options - {Object} The user options passed to the read call. + */ + handleRead: function(response, options) { + options = OpenLayers.Util.extend({}, options); + OpenLayers.Util.applyDefaults(options, this.options); + + if(options.callback) { + var request = response.priv; + if(request.status >= 200 && request.status < 300) { + // success + var result = this.parseResponse(request, options.readOptions); + if (result && result.success !== false) { + if (options.readOptions && options.readOptions.output == "object") { + OpenLayers.Util.extend(response, result); + } else { + response.features = result; + } + response.code = OpenLayers.Protocol.Response.SUCCESS; + } else { + // failure (service exception) + response.code = OpenLayers.Protocol.Response.FAILURE; + response.error = result; + } + } else { + // failure + response.code = OpenLayers.Protocol.Response.FAILURE; + } + options.callback.call(options.scope, response); + } + }, + + /** + * Method: parseResponse + * Read HTTP response body and return features + * + * Parameters: + * request - {XMLHttpRequest} The request object + * options - {Object} Optional object to pass to format's read + * + * Returns: + * {Object} or {Array({})} or + * {} + * An object with a features property, an array of features or a single + * feature. + */ + parseResponse: function(request, options) { + var doc = request.responseXML; + if(!doc || !doc.documentElement) { + doc = request.responseText; + } + if(!doc || doc.length <= 0) { + return null; + } + var result = (this.readFormat !== null) ? this.readFormat.read(doc) : + this.format.read(doc, options); + if (!this.featureNS) { + var format = this.readFormat || this.format; + this.featureNS = format.featureNS; + // no need to auto-configure again on subsequent reads + format.autoConfig = false; + if (!this.geometryName) { + this.setGeometryName(format.geometryName); + } + } + return result; + }, + + /** + * Method: commit + * Given a list of feature, assemble a batch request for update, create, + * and delete transactions. A commit call on the prototype amounts + * to writing a WCS transaction - so the write method on the format + * is used. + * + * Parameters: + * features - {Array()} + * options - {Object} + * + * Valid options properties: + * nativeElements - {Array({Object})} Array of objects with information for writing + * out elements, these objects have vendorId, safeToIgnore and + * value properties. The element is intended to allow access to + * vendor specific capabilities of any particular web feature server or + * datastore. + * + * Returns: + * {} A response object with a features + * property containing any insertIds and a priv property referencing + * the XMLHttpRequest object. + */ + commit: function(features, options) { + + options = OpenLayers.Util.extend({}, options); + OpenLayers.Util.applyDefaults(options, this.options); + + var response = new OpenLayers.Protocol.Response({ + requestType: "commit", + reqFeatures: features + }); + response.priv = OpenLayers.Request.POST({ + url: options.url, + headers: options.headers, + data: this.format.write(features, options), + callback: this.createCallback(this.handleCommit, response, options) + }); + + return response; + }, + + /** + * Method: handleCommit + * Called when the commit request returns. + * + * Parameters: + * response - {} The response object to pass + * to the user callback. + * options - {Object} The user options passed to the commit call. + */ + handleCommit: function(response, options) { + if(options.callback) { + var request = response.priv; + + // ensure that we have an xml doc + var data = request.responseXML; + if(!data || !data.documentElement) { + data = request.responseText; + } + + var obj = this.format.read(data) || {}; + + response.insertIds = obj.insertIds || []; + if (obj.success) { + response.code = OpenLayers.Protocol.Response.SUCCESS; + } else { + response.code = OpenLayers.Protocol.Response.FAILURE; + response.error = obj; + } + options.callback.call(options.scope, response); + } + }, + + /** + * Method: filterDelete + * Send a request that deletes all features by their filter. + * + * Parameters: + * filter - {} filter + */ + filterDelete: function(filter, options) { + options = OpenLayers.Util.extend({}, options); + OpenLayers.Util.applyDefaults(options, this.options); + + var response = new OpenLayers.Protocol.Response({ + requestType: "commit" + }); + + var root = this.format.createElementNSPlus("wcs:Transaction", { + attributes: { + service: "WCS", + version: this.version + } + }); + + var deleteNode = this.format.createElementNSPlus("wcs:Delete", { + attributes: { + typeName: (options.featureNS ? this.featurePrefix + ":" : "") + + options.featureType + } + }); + + if(options.featureNS) { + deleteNode.setAttribute("xmlns:" + this.featurePrefix, options.featureNS); + } + var filterNode = this.format.writeNode("ogc:Filter", filter); + + deleteNode.appendChild(filterNode); + + root.appendChild(deleteNode); + + var data = OpenLayers.Format.XML.prototype.write.apply( + this.format, [root] + ); + + return OpenLayers.Request.POST({ + url: this.url, + callback : options.callback || function(){}, + data: data + }); + + }, + + /** + * Method: abort + * Abort an ongoing request, the response object passed to + * this method must come from this protocol (as a result + * of a read, or commit operation). + * + * Parameters: + * response - {} + */ + abort: function(response) { + if (response) { + response.priv.abort(); + } + }, + + CLASS_NAME: "OpenLayers.Protocol.WCS.v1" +}); diff --git a/lib/OpenLayers/Protocol/WCS/v1_0_0.js b/lib/OpenLayers/Protocol/WCS/v1_0_0.js new file mode 100644 index 0000000000..54a5b8b3a2 --- /dev/null +++ b/lib/OpenLayers/Protocol/WCS/v1_0_0.js @@ -0,0 +1,43 @@ +/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the 2-clause BSD license. + * See license.txt in the OpenLayers distribution or repository for the + * full text of the license. */ + +/** + * @requires OpenLayers/Protocol/WCS/v1.js + */ + +/** + * Class: OpenLayers.Protocol.WCS.v1_0_0 + * A WCS v1.0.0 protocol for vector layers. Create a new instance with the + * constructor. + * + * Inherits from: + * - + */ +OpenLayers.Protocol.WCS.v1_0_0 = OpenLayers.Class(OpenLayers.Protocol.WCS.v1, { + + /** + * Property: version + * {String} WCS version number. + */ + version: "1.0.0", + + /** + * Constructor: OpenLayers.Protocol.WCS.v1_0_0 + * A class for giving layers WCS v1.0.0 protocol. + * + * Parameters: + * options - {Object} Optional object whose properties will be set on the + * instance. + * + * Valid options properties: + * featureType - {String} Local (without prefix) feature typeName (required). + * featureNS - {String} Feature namespace (optional). + * featurePrefix - {String} Feature namespace alias (optional - only used + * if featureNS is provided). Default is 'feature'. + * geometryName - {String} Name of geometry attribute. Default is 'the_geom'. + */ + + CLASS_NAME: "OpenLayers.Protocol.WCS.v1_0_0" +}); \ No newline at end of file diff --git a/lib/OpenLayers/Protocol/WCS/v1_1_0.js b/lib/OpenLayers/Protocol/WCS/v1_1_0.js new file mode 100644 index 0000000000..05b86f11e8 --- /dev/null +++ b/lib/OpenLayers/Protocol/WCS/v1_1_0.js @@ -0,0 +1,37 @@ +/* ====================================================================== + OpenLayers/Protocol/WCS/v1_1_0.js + ====================================================================== */ + +/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the 2-clause BSD license. + * See license.txt in the OpenLayers distribution or repository for the + * full text of the license. */ + +/** + * @requires OpenLayers/Protocol/WCS/v1.js + */ + +/** + * Class: OpenLayers.Protocol.WCS.v1_1_0 + * A WCS v1.1.0 protocol for vector layers. Create a new instance with the + * constructor. + * + * Differences from the v1.0.0 protocol: + * - uses Filter Encoding 1.1.0 instead of 1.0.0 + * - uses GML 3 instead of 2 if no format is provided + * + * Inherits from: + * - + */ +OpenLayers.Protocol.WCS.v1_1_0 = OpenLayers.Class(OpenLayers.Protocol.WCS.v1, { + + /** + * Property: version + * {String} WCS version number. + */ + version: "1.1.0", + + + + CLASS_NAME: "OpenLayers.Protocol.WCS.v1_1_0" +}); diff --git a/tests/Format/WCSCapabilities.html b/tests/Format/WCSCapabilities.html new file mode 100644 index 0000000000..aa3d3267ae --- /dev/null +++ b/tests/Format/WCSCapabilities.html @@ -0,0 +1,43 @@ + + + + + + + + \ No newline at end of file diff --git a/tests/Format/WCSCapabilities/v1.html b/tests/Format/WCSCapabilities/v1.html new file mode 100644 index 0000000000..ea4dd1129c --- /dev/null +++ b/tests/Format/WCSCapabilities/v1.html @@ -0,0 +1,181 @@ + + + + + + + + From d0986de775c114ea040ac5fc31a285466fe2b854 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Fri, 21 Dec 2012 18:51:39 +0100 Subject: [PATCH 03/50] WCS 1.0.0 parsing now passing all tests --- lib/OpenLayers/Format/WCSCapabilities/v1.js | 15 +- .../Format/WCSCapabilities/v1_0_0.js | 167 +++++++++++++----- tests/Format/WCSCapabilities/v1.html | 39 ++-- 3 files changed, 157 insertions(+), 64 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1.js b/lib/OpenLayers/Format/WCSCapabilities/v1.js index 47aa0b9411..54d2f3e0b7 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1.js @@ -28,6 +28,11 @@ OpenLayers.Format.WCSCapabilities.v1 = OpenLayers.Class( ows: "http://www.opengis.net/ows" }, + regExes: { + trimSpace: (/^\s*|\s*$/g), + splitSpace: (/\s+/) + }, + /** * Property: defaultPrefix */ @@ -78,16 +83,6 @@ OpenLayers.Format.WCSCapabilities.v1 = OpenLayers.Class( "WCS_Capabilities": function(node, obj) { // In 1.0.0, this was WCS_Capabilties, changed in 1.1.0 this.readChildNodes(node, obj); }, - "Name": function(node, obj) { //???? - var name = this.getChildValue(node); - if(name) { - var parts = name.split(":"); - obj.name = parts.pop(); - if(parts.length > 0) { - obj.featureNS = this.lookupNamespaceURI(node, parts[0]); - } - } - }, "Title": function(node, obj) { var title = this.getChildValue(node); if(title) { diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index e5d0803b62..d175f2a9f3 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -36,59 +36,142 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( */ readers: { "wcs": OpenLayers.Util.applyDefaults({ - "Service": function(node, capabilities) { - capabilities.service = {}; - this.readChildNodes(node, capabilities.service); + "Service": function(node, obj) { + obj.service = {}; + this.readChildNodes(node, obj.service); }, - "Fees": function(node, service) { - var fees = this.getChildValue(node); - if (fees && fees.toLowerCase() != "none") { - service.fees = fees; - } + "name": function(node, service) { + service.name = this.getChildValue(node); }, - "AccessConstraints": function(node, service) { - var constraints = this.getChildValue(node); - if (constraints && constraints.toLowerCase() != "none") { - service.accessConstraints = constraints; - } + "label": function(node, service) { + service.label = this.getChildValue(node); }, - "OnlineResource": function(node, service) { - var onlineResource = this.getChildValue(node); - if (onlineResource && onlineResource.toLowerCase() != "none") { - service.onlineResource = onlineResource; - } + "keywords": function(node, service) { + service.keywords = []; + this.readChildNodes(node, service.keywords); }, - "Keywords": function(node, service) { - var keywords = this.getChildValue(node); - if (keywords && keywords.toLowerCase() != "none") { - service.keywords = keywords.split(', '); - } + "keyword": function(node, keywords) { + keywords.push(this.getChildValue(node)); // Append the keyword to the keywords list }, - "Capability": function(node, capabilities) { - capabilities.capability = {}; - this.readChildNodes(node, capabilities.capability); + "responsibleParty": function(node, service) { + service.responsibleParty = {}; + this.readChildNodes(node, service.responsibleParty); }, - "Request": function(node, obj) { - obj.request = {}; - this.readChildNodes(node, obj.request); + "individualName": function(node, responsibleParty) { + responsibleParty.individualName = this.getChildValue(node); }, - "GetFeature": function(node, request) { - request.getfeature = { - href: {}, // DCPType - formats: [] // ResultFormat - }; - this.readChildNodes(node, request.getfeature); + "organisationName": function(node, responsibleParty) { + responsibleParty.organisationName = this.getChildValue(node); }, - "ResultFormat": function(node, obj) { - var children = node.childNodes; - var childNode; - for(var i=0; i. Only write the data if everything parsed neatly. + // This works well for the data samples I have access to, but may need to be generalized to cover other possible use cases. + var nodeList = this.getElementsByTagNameNS(node, "http://www.opengis.net/gml", "pos"); + + // We expect two nodes here, to create the corners of a bounding box + if(nodeList.length == 2) { + var min = {}, + max = {}; + + var ok = true; + + // min + var coordString = nodeList[0].firstChild.nodeValue; + + coordString = coordString.replace(this.regExes.trimSpace, ""); + var coords = coordString.split(this.regExes.splitSpace); + + if(coords.length == 2) { + min.lon = coords[0]; + min.lat = coords[1]; + } else { + ok = false; + } + + // max + var coordString = nodeList[1].firstChild.nodeValue; + + coordString = coordString.replace(this.regExes.trimSpace, ""); + var coords = coordString.split(this.regExes.splitSpace); + + if(coords.length == 2) { + max.lon = coords[0]; + max.lat = coords[1]; + } else { + ok = false; + } + + if(ok) { + coverageOfferingBrief.lonLatEnvelope = {}; + coverageOfferingBrief.lonLatEnvelope.srsName = node.getAttribute("srsName"); + coverageOfferingBrief.lonLatEnvelope.min = min; + coverageOfferingBrief.lonLatEnvelope.max = max; } } + }, + + //////////////////////////////////////////////////////////////////////////////////////////// + + "DCPType": function(node, obj) { this.readChildNodes(node, obj); }, diff --git a/tests/Format/WCSCapabilities/v1.html b/tests/Format/WCSCapabilities/v1.html index ea4dd1129c..24bc5ec2d7 100644 --- a/tests/Format/WCSCapabilities/v1.html +++ b/tests/Format/WCSCapabilities/v1.html @@ -21,26 +21,41 @@ } function test_read(t) { - t.plan(37); // Number of tests performed: If you add a test below, be sure to increment this accordingly + t.plan(25); // Number of tests performed: If you add a test below, be sure to increment this accordingly var parser = new OpenLayers.Format.WCSCapabilities(); // GeoServer, v1.0.0 - var text = 'MapServer WCSGeospatial WebServicesLuxembourg!Franko LemmerCRP Henri TudorR+D engineer00352 4321 234500352 43210 123
    128, rue de LuxembourgEsch-sur-Alzette4221Luxembourgfranko.lemmer@flensburger.de
    nonenone
    application/vnd.ogc.se_xmlro_dsm4.44444 51.5151515.55555 52.525252ro_dsm_mini4.47489346945755 51.91594537869274.47687824892444 51.9170706688033ro_irra4.471333734139 51.9128134273834.4808508475645 51.9248713705576ro_irra_ext4.10024171314823 51.93597649928444.21909054278063 52.001415228243
    '; + var text = 'MapServer WCSGeospatial WebServicesLuxembourg!Franko LemmerCRP Henri TudorR+D engineer64633206465955
    66, rue de LuxembourgEsch-sur-Alzette97202Luxembourgfranko.lemmer@flensburger.de
    mucho dineroOpen to the public
    application/vnd.ogc.se_xmlro_dsm4.44444 51.5151515.55555 52.525252ro_dsm_mini4.47489346945755 51.91594537869274.47687824892444 51.9170706688033ro_irra4.471333734139 51.9128134273834.4808508475645 51.9248713705576ro_irra_ext4.10024171314823 51.93597649928444.21909054278063 52.001415228243
    '; -debugger; var res = parser.read(text); t.ok(!res.error, "Parsing XML generated no errors"); - t.eq(res.operationsMetadata["GetFeature"].dcp.http.get[0].url, "http://services.magnificent.get.lu/cgi-bin/mapserv?", "GetFeature GET endpoint correctly parsed"); - t.eq(res.operationsMetadata["GetFeature"].dcp.http.post[0].url, "http://services.magnificent.post.lu/cgi-bin/mapserv?", "GetFeature POST endpoint correctly parsed"); - var ft = res.featureTypeList.featureTypes; - t.eq(ft.length, 4, "number of feature types correct"); - t.eq(ft[0]["label"], "Rotterdam DSM", "label of first feature type correct"); - t.eq(ft[0]["name"], "ro_dsm", "name of first feature type correct"); - t.eq(ft[0]["featureNS"], "http://www.census.gov", "ns of first feature type correct"); - t.eq(ft[0]["srs"], "urn:ogc:def:crs:OGC:1.3:CRS84", "srs of first feature type correct"); - t.eq(ft[0]["title"], "Manhattan (NY) landmarks", "title of first feature type correct"); + t.eq(res.service.fees, "mucho dinero", "Service>Fees correctly parsed"); + t.eq(res.service.accessConstraints, "Open to the public", "Service>AccessConstraints correctly parsed"); + t.eq(res.service.keywords.length, 2, "Correct number of Service>Keywords found"); + t.eq(res.service.keywords[0], "Geospatial WebServices", "Service>Keywords correctly parsed"); + t.eq(res.service.label, "WCS Sample Data Server 1.0.0", "Service>Label correctly parsed"); + t.eq(res.service.name, "MapServer WCS", "Service>Name correctly parsed"); + t.eq(res.service.responsibleParty.individualName, "Franko Lemmer", "Service>ResponsibleParty>IndividualName correctly parsed"); + t.eq(res.service.responsibleParty.organisationName, "CRP Henri Tudor", "Service>ResponsibleParty>OrganisationName correctly parsed"); + t.eq(res.service.responsibleParty.positionName, "R+D engineer", "Service>ResponsibleParty>PositionName correctly parsed"); + t.eq(res.service.responsibleParty.contactInfo.address.city, "Esch-sur-Alzette", "Service>responsibleParty>ContactInfo>Address>City correctly parsed"); + t.eq(res.service.responsibleParty.contactInfo.address.country, "Luxembourg", "Service>responsibleParty>ContactInfo>Address>Country correctly parsed"); + t.eq(res.service.responsibleParty.contactInfo.address.deliveryPoint, "66, rue de Luxembourg", "Service>responsibleParty>ContactInfo>Address>DeliveryPoint correctly parsed"); + t.eq(res.service.responsibleParty.contactInfo.address.electronicMailAddress, "franko.lemmer@flensburger.de", "Service>responsibleParty>ContactInfo>Address>ElectronicMailAddress correctly parsed"); + t.eq(res.service.responsibleParty.contactInfo.address.postalCode, "97202", "Service>responsibleParty>ContactInfo>Address>PostalCode correctly parsed"); + t.eq(res.service.responsibleParty.contactInfo.phone.facsimile, "6465955", "Service>responsibleParty>ContactInfo>Phone>Facsimile correctly parsed"); + t.eq(res.service.responsibleParty.contactInfo.phone.voice, "6463320", "Service>responsibleParty>ContactInfo>Phone>Voice correctly parsed"); + t.eq(res.contentMetadata.length, 4, "Correct number of metadata records found"); + t.eq(res.contentMetadata[0].label, "Rotterdam DSM", "ContentMetadata>Label correctly parsed"); + t.eq(res.contentMetadata[0].lonLatEnvelope.min.lat, "51.515151", "ContentMetadata>lonLatEnvelope>Min>Lat correctly parsed"); + t.eq(res.contentMetadata[0].lonLatEnvelope.min.lon, "4.44444", "ContentMetadata>lonLatEnvelope>Min>Lon correctly parsed"); + t.eq(res.contentMetadata[0].lonLatEnvelope.max.lat, "52.525252", "ContentMetadata>lonLatEnvelope>Max>Lat correctly parsed"); + t.eq(res.contentMetadata[0].lonLatEnvelope.max.lon, "5.55555", "ContentMetadata>lonLatEnvelope>Max>Lon correctly parsed"); + t.eq(res.contentMetadata[0].lonLatEnvelope.srsName, "urn:ogc:def:crs:OGC:1.3:CRS84", "ContentMetadata>lonLatEnvelope>SrsName correctly parsed"); + t.eq(res.contentMetadata[0].name, "ro_dsm", "ContentMetadata>Name correctly parsed"); + // // GeoServer, v1.0.0 // text = 'WFSGeoServer Web Feature ServiceThis is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction.WFS, WMS, GEOSERVERhttp://localhost:80/geoserver/wfsNONENONEtiger:poly_landmarksManhattan (NY) landmarksManhattan landmarks, identifies water, lakes, parks, interesting buildilngsDS_poly_landmarks, poly_landmarks, landmarks, manhattanEPSG:4326tiger:poiManhattan (NY) points of interestPoints of interest in New York, New York (on Manhattan). One of the attributes contains the name of a file with a picture of the point of interest.poi, DS_poi, points_of_interest, ManhattanEPSG:4326tiger:tiger_roadsManhattan (NY) roadsHighly simplified road layout of Manhattan in New York..DS_tiger_roads, tiger_roads, roadsEPSG:4326sf:archsitesSpearfish archeological sitesSample data from GRASS, archeological sites location, Spearfish, South Dakota, USAarchsites, sfArchsites, spearfish, archeologyEPSG:26713sf:bugsitesSpearfish bug locationsSample data from GRASS, bug sites location, Spearfish, South Dakota, USAsfBugsites, bugsites, insects, spearfish, tiger_beetlesEPSG:26713sf:restrictedSpearfish restricted areasSample data from GRASS, restricted areas, Spearfish, South Dakota, USArestricted, sfRestricted, spearfish, areasEPSG:26713sf:roadsSpearfish roadsSample data from GRASS, road layout, Spearfish, South Dakota, USAsfRoads, roads, spearfishEPSG:26713sf:streamsSpearfish streamsSample data from GRASS, streams, Spearfish, South Dakota, USAsfStreams, streams, spearfishEPSG:26713topp:tasmania_citiesTasmania citiesCities in Tasmania (actually, just the capital)cities, TasmaniaEPSG:4326topp:tasmania_roadsTasmania roadsMain Tasmania roadsRoads, TasmaniaEPSG:4326topp:tasmania_state_boundariesTasmania state boundariesTasmania state boundariestasmania_state_boundaries, Tasmania, boundariesEPSG:4326topp:tasmania_water_bodiesTasmania water bodiesTasmania water bodiesLakes, Bodies, Australia, Water, TasmaniaEPSG:4326topp:statesUSA PopulationThis is some census data on the states.census, united, boundaries, state, statesEPSG:4326tiger:giant_polygonWorld rectangleA simple rectangular polygon covering most of the world, it\'s only used for the purpose of providing a background (WMS bgcolor could be used instead)DS_giant_polygon, giant_polygonEPSG:4326absabs_2abs_3abs_4acosAreaasinatanatan2betweenboundaryboundaryDimensionbufferbufferWithSegmentsceilcentroidclassifyCollection_AverageCollection_BoundsCollection_CountCollection_MaxCollection_MedianCollection_MinCollection_SumCollection_UniqueConcatenatecontainsconvexHullcoscrossesdateFormatdateParsedifferencedimensiondisjointdistancedouble2boolendPointenvelopeEqualIntervalequalsExactequalsExactToleranceequalToexpexteriorRingfloorgeometryTypegeomFromWKTgeomLengthgetGeometryNgetXgetYgetZgreaterEqualThangreaterThanidIEEEremainderif_then_elsein10in2in3in4in5in6in7in8in9int2bboolint2ddoubleinteriorPointinteriorRingNintersectionintersectsisClosedisEmptyisLikeisNullisRingisSimpleisValidisWithinDistancelengthlessEqualThanlessThanlogmaxmax_2max_3max_4minmin_2min_3min_4notnotEqualTonumGeometriesnumInteriorRingnumPointsoverlapsparseBooleanparseDoubleparseIntpipointNpowPropertyExistsQuantilerandomrelaterelatePatternrintroundround_2roundDoublesinsqrtStandardDeviationstartPointstrConcatstrEndsWithstrEqualsIgnoreCasestrIndexOfstrLastIndexOfstrLengthstrMatchesstrReplacestrStartsWithstrSubstringstrSubstringStartstrToLowerCasestrToUpperCasestrTrimsymDifferencetantoDegreestoRadianstouchestoWKTunionUniqueIntervalwithin'; From 8ff05cdeaca4dc840396a2adb5a1718f2212d9ae Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Mon, 24 Dec 2012 18:19:42 +0100 Subject: [PATCH 04/50] WCS 1.1.0 parsing correctlyy; error property still not correctly set so parsing reports errors. --- lib/OpenLayers/Format/WCSCapabilities/v1.js | 11 --- .../Format/WCSCapabilities/v1_0_0.js | 12 ++++ .../Format/WCSCapabilities/v1_1_0.js | 70 +++++++++++-------- tests/Format/WCSCapabilities/v1.html | 16 +++-- 4 files changed, 63 insertions(+), 46 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1.js b/lib/OpenLayers/Format/WCSCapabilities/v1.js index 54d2f3e0b7..89981f3f9d 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1.js @@ -17,17 +17,6 @@ OpenLayers.Format.WCSCapabilities.v1 = OpenLayers.Class( OpenLayers.Format.XML, { - /** - * Property: namespaces - * {Object} Mapping of namespace aliases to namespace URIs. - */ - namespaces: { - wcs: "http://www.opengis.net/wcs", - xlink: "http://www.w3.org/1999/xlink", - xsi: "http://www.w3.org/2001/XMLSchema-instance", - ows: "http://www.opengis.net/ows" - }, - regExes: { trimSpace: (/^\s*|\s*$/g), splitSpace: (/\s+/) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index d175f2a9f3..e68b004a74 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -26,6 +26,18 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( * this instance. */ + + /** + * Property: namespaces + * {Object} Mapping of namespace aliases to namespace URIs. + */ + namespaces: { + wcs: "http://www.opengis.net/wcs", + xlink: "http://www.w3.org/1999/xlink", + xsi: "http://www.w3.org/2001/XMLSchema-instance", + ows: "http://www.opengis.net/ows" + }, + /** * Property: readers * Contains public functions, grouped by namespace prefix, that will diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index c3e301a5c1..b991bca48e 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -18,21 +18,19 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( OpenLayers.Format.WCSCapabilities.v1, { + /** - * Property: regExes - * Compiled regular expressions for manipulating strings. + * Property: namespaces + * {Object} Mapping of namespace aliases to namespace URIs. */ - regExes: { - trimSpace: (/^\s*|\s*$/g), - removeSpace: (/\s*/g), - splitSpace: (/\s+/), - trimComma: (/\s*,\s*/g) + namespaces: { + wcs: "http://www.opengis.net/wcs/1.1", + xlink: "http://www.w3.org/1999/xlink", + xsi: "http://www.w3.org/2001/XMLSchema-instance", + ows: "http://www.opengis.net/ows/1.1" }, - errorProperty: "Contents", // <== Not sure if this is strictly required by standard... maybe better to set to NULL? - - /** * Constructor: OpenLayers.Format.WCSCapabilities.v1_1_0 * Create a new parser for WCS capabilities version 1.1.0. @@ -52,44 +50,56 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( */ readers: { "wcs": OpenLayers.Util.applyDefaults({ + "Capabilities": function(node, obj) { // In 1.0.0, this was WCS_Capabilties, in 1.1.0, it's just Capabilities this.readChildNodes(node, obj); }, "Contents": function(node, request) { - request.featureTypeList = { - contents: [] - }; - this.readChildNodes(node, request.contents); + var contents = []; + this.readChildNodes(node, contents); + + request.contents = contents; }, - "CoverageSummary": function(node, request) { - request.featureTypeList = { - coverageSummary: [] - }; - this.readChildNodes(node, request.coverageSummary); + "CoverageSummary": function(node, contents) { + contents.coverageSummary = {}; + this.readChildNodes(node, contents.coverageSummary); }, - "Identifier": function(node, obj) { - obj.identifier = this.getChildValue(node); + "Identifier": function(node, coverageSummary) { + coverageSummary.identifier = this.getChildValue(node); }, - "SupportedCRS": function(node, obj) { + "Title": function(node, coverageSummary) { + coverageSummary.title = this.getChildValue(node); + }, + + "Abstract": function(node, coverageSummary) { + coverageSummary.abstract = this.getChildValue(node); + }, + + "SupportedCRS": function(node, coverageSummary) { var crs = this.getChildValue(node); if(crs) { - if(!obj["supportedCRS"]) { - obj["supportedCRS"] = []; + if(!coverageSummary["supportedCRS"]) { + coverageSummary["supportedCRS"] = []; } - obj["supportedCRS"].push(crs); + coverageSummary["supportedCRS"].push(crs); } }, - "DefaultSRS": function(node, obj) { - var defaultSRS = this.getChildValue(node); - if (defaultSRS) { - obj.srs = defaultSRS; + "SupportedFormat": function(node, coverageSummary) { + var format = this.getChildValue(node); + if(format) { + if(!coverageSummary["supportedFormat"]) { + coverageSummary["supportedFormat"] = []; + } + coverageSummary["supportedFormat"].push(format); } - } + }, + + }, OpenLayers.Format.WCSCapabilities.v1.prototype.readers["wcs"]), "ows": OpenLayers.Format.OWSCommon.v1.prototype.readers["ows"] }, diff --git a/tests/Format/WCSCapabilities/v1.html b/tests/Format/WCSCapabilities/v1.html index 24bc5ec2d7..ac4096b335 100644 --- a/tests/Format/WCSCapabilities/v1.html +++ b/tests/Format/WCSCapabilities/v1.html @@ -21,7 +21,7 @@ } function test_read(t) { - t.plan(25); // Number of tests performed: If you add a test below, be sure to increment this accordingly + t.plan(26); // Number of tests performed: If you add a test below, be sure to increment this accordingly var parser = new OpenLayers.Format.WCSCapabilities(); @@ -30,6 +30,8 @@ var res = parser.read(text); + debugger; + t.ok(!res.error, "Parsing XML generated no errors"); t.eq(res.service.fees, "mucho dinero", "Service>Fees correctly parsed"); t.eq(res.service.accessConstraints, "Open to the public", "Service>AccessConstraints correctly parsed"); @@ -57,11 +59,15 @@ t.eq(res.contentMetadata[0].name, "ro_dsm", "ContentMetadata>Name correctly parsed"); - // // GeoServer, v1.0.0 - // text = 'WFSGeoServer Web Feature ServiceThis is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction.WFS, WMS, GEOSERVERhttp://localhost:80/geoserver/wfsNONENONEtiger:poly_landmarksManhattan (NY) landmarksManhattan landmarks, identifies water, lakes, parks, interesting buildilngsDS_poly_landmarks, poly_landmarks, landmarks, manhattanEPSG:4326tiger:poiManhattan (NY) points of interestPoints of interest in New York, New York (on Manhattan). One of the attributes contains the name of a file with a picture of the point of interest.poi, DS_poi, points_of_interest, ManhattanEPSG:4326tiger:tiger_roadsManhattan (NY) roadsHighly simplified road layout of Manhattan in New York..DS_tiger_roads, tiger_roads, roadsEPSG:4326sf:archsitesSpearfish archeological sitesSample data from GRASS, archeological sites location, Spearfish, South Dakota, USAarchsites, sfArchsites, spearfish, archeologyEPSG:26713sf:bugsitesSpearfish bug locationsSample data from GRASS, bug sites location, Spearfish, South Dakota, USAsfBugsites, bugsites, insects, spearfish, tiger_beetlesEPSG:26713sf:restrictedSpearfish restricted areasSample data from GRASS, restricted areas, Spearfish, South Dakota, USArestricted, sfRestricted, spearfish, areasEPSG:26713sf:roadsSpearfish roadsSample data from GRASS, road layout, Spearfish, South Dakota, USAsfRoads, roads, spearfishEPSG:26713sf:streamsSpearfish streamsSample data from GRASS, streams, Spearfish, South Dakota, USAsfStreams, streams, spearfishEPSG:26713topp:tasmania_citiesTasmania citiesCities in Tasmania (actually, just the capital)cities, TasmaniaEPSG:4326topp:tasmania_roadsTasmania roadsMain Tasmania roadsRoads, TasmaniaEPSG:4326topp:tasmania_state_boundariesTasmania state boundariesTasmania state boundariestasmania_state_boundaries, Tasmania, boundariesEPSG:4326topp:tasmania_water_bodiesTasmania water bodiesTasmania water bodiesLakes, Bodies, Australia, Water, TasmaniaEPSG:4326topp:statesUSA PopulationThis is some census data on the states.census, united, boundaries, state, statesEPSG:4326tiger:giant_polygonWorld rectangleA simple rectangular polygon covering most of the world, it\'s only used for the purpose of providing a background (WMS bgcolor could be used instead)DS_giant_polygon, giant_polygonEPSG:4326absabs_2abs_3abs_4acosAreaasinatanatan2betweenboundaryboundaryDimensionbufferbufferWithSegmentsceilcentroidclassifyCollection_AverageCollection_BoundsCollection_CountCollection_MaxCollection_MedianCollection_MinCollection_SumCollection_UniqueConcatenatecontainsconvexHullcoscrossesdateFormatdateParsedifferencedimensiondisjointdistancedouble2boolendPointenvelopeEqualIntervalequalsExactequalsExactToleranceequalToexpexteriorRingfloorgeometryTypegeomFromWKTgeomLengthgetGeometryNgetXgetYgetZgreaterEqualThangreaterThanidIEEEremainderif_then_elsein10in2in3in4in5in6in7in8in9int2bboolint2ddoubleinteriorPointinteriorRingNintersectionintersectsisClosedisEmptyisLikeisNullisRingisSimpleisValidisWithinDistancelengthlessEqualThanlessThanlogmaxmax_2max_3max_4minmin_2min_3min_4notnotEqualTonumGeometriesnumInteriorRingnumPointsoverlapsparseBooleanparseDoubleparseIntpipointNpowPropertyExistsQuantilerandomrelaterelatePatternrintroundround_2roundDoublesinsqrtStandardDeviationstartPointstrConcatstrEndsWithstrEqualsIgnoreCasestrIndexOfstrLastIndexOfstrLengthstrMatchesstrReplacestrStartsWithstrSubstringstrSubstringStartstrToLowerCasestrToUpperCasestrTrimsymDifferencetantoDegreestoRadianstouchestoWKTunionUniqueIntervalwithin'; - // res = parser.read(text); + // GeoServer, v1.1.0 + text = 'Web-Service Demo with data stored at TUDOR siteThis installation serves different Web-Service types (WMS, WFS) for testingGeospatial WebServicesKeyword OneKeyword Two!!OGC WCS1.1.0No fee!Unconstrained!CRP Henri TudorRoy DumerdeR+D engineer6463320646595566, rue de LuxembourgEsch-sur-Alzette97202Luxembourgflappy@tutones.com24/7by phoneGIS-AnalystWCS1.1.0WCS1.1.0ro_dsmro_dsm_miniro_irraro_irra_extWCS1.1.0ro_dsmro_dsm_miniro_irraro_irra_extNEAREST_NEIGHBOURBILINEARimage/tiffimage/pngimage/jpegimage/gifimage/png; mode=8bitfalseurn:ogc:def:crs:epsg::4326Rotterdam DSMDigital Surface Model (DSM) raster data set of inner city Rotterdam4.471333734139 51.9128134273834.4808508475645 51.9248713705576urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_dsmRotterdam sample DSM subsetThis a test data set of Rotterdams DSM subset4.47489346945755 51.91594537869274.47687824892444 51.9170706688033urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_dsm_miniRotterdam (Ljinbaan) solar irradiation data 2010This a result data set of a solar computation of Ljinbaan area. It shows the sum of kWh/a per sqmeter for 20104.471333734139 51.9128134273834.4808508475645 51.9248713705576urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_irraRotterdam (extended) solar irradiation data 2010This a result data set of a solar computation of extended Rotterdam area. It shows the sum of kWh/a per sqmeter for 20104.10024171314823 51.93597649928444.21909054278063 52.001415228243urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_irra_ext'; - // t.ok(!res.error, "Parsing XML generated no errors"); + + res = parser.read(text); +debugger; + + + t.ok(!res.error, "Parsing XML generated no errors"); // ft = res.featureTypeList.featureTypes; // t.eq(ft.length, 14, "number of feature types correct"); // t.eq(ft[0]["abstract"], "Manhattan landmarks, identifies water, lakes, parks, interesting buildilngs", "abstract of first feature type correct"); From b6c2c26580fcbc2bf2f5884a61ba9b44cf62e9df Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Thu, 27 Dec 2012 13:29:02 +0100 Subject: [PATCH 05/50] WCS parsing working properly, but needs more tests; moved errorProperty down to parser, where it arguably belongs, and where it has to live to work with WCS. Also removed null error property on versionedOGC. --- lib/OpenLayers/Format/WCSCapabilities.js | 8 -------- .../Format/WCSCapabilities/v1_0_0.js | 10 ++++++++++ .../Format/WCSCapabilities/v1_1_0.js | 9 +++++++++ lib/OpenLayers/Format/WFSCapabilities.js | 9 --------- lib/OpenLayers/Format/WFSCapabilities/v1.js | 10 ++++++++++ lib/OpenLayers/Format/XML/VersionedOGC.js | 18 +++++++----------- tests/Format/WCSCapabilities/v1.html | 3 --- 7 files changed, 36 insertions(+), 31 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities.js b/lib/OpenLayers/Format/WCSCapabilities.js index ae034a5227..082805602c 100644 --- a/lib/OpenLayers/Format/WCSCapabilities.js +++ b/lib/OpenLayers/Format/WCSCapabilities.js @@ -22,14 +22,6 @@ OpenLayers.Format.WCSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Versi */ defaultVersion: "1.1.0", - /** - * APIProperty: errorProperty - * {String} Which property of the returned object to check for in order to - * determine whether or not parsing has failed. In the case that the - * errorProperty is undefined on the returned object, the document will be - * run through an OGCExceptionReport parser. - */ - errorProperty: "service", /** * Constructor: OpenLayers.Format.WCSCapabilities diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index e68b004a74..ca0799ac79 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -38,6 +38,16 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( ows: "http://www.opengis.net/ows" }, + /** + * APIProperty: errorProperty + * {String} Which property of the returned object to check for in order to + * determine whether or not parsing has failed. In the case that the + * errorProperty is undefined on the returned object, the document will be + * run through an OGCExceptionReport parser. + */ + errorProperty: "service", + + /** * Property: readers * Contains public functions, grouped by namespace prefix, that will diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index b991bca48e..7e2061afcb 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -30,6 +30,15 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( ows: "http://www.opengis.net/ows/1.1" }, + /** + * APIProperty: errorProperty + * {String} Which property of the returned object to check for in order to + * determine whether or not parsing has failed. In the case that the + * errorProperty is undefined on the returned object, the document will be + * run through an OGCExceptionReport parser. + */ + errorProperty: "operationsMetadata", + /** * Constructor: OpenLayers.Format.WCSCapabilities.v1_1_0 diff --git a/lib/OpenLayers/Format/WFSCapabilities.js b/lib/OpenLayers/Format/WFSCapabilities.js index ec82ae984b..ba4598645b 100644 --- a/lib/OpenLayers/Format/WFSCapabilities.js +++ b/lib/OpenLayers/Format/WFSCapabilities.js @@ -21,15 +21,6 @@ OpenLayers.Format.WFSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Versi * {String} Version number to assume if none found. Default is "1.1.0". */ defaultVersion: "1.1.0", - - /** - * APIProperty: errorProperty - * {String} Which property of the returned object to check for in order to - * determine whether or not parsing has failed. In the case that the - * errorProperty is undefined on the returned object, the document will be - * run through an OGCExceptionReport parser. - */ - errorProperty: "featureTypeList", /** * Constructor: OpenLayers.Format.WFSCapabilities diff --git a/lib/OpenLayers/Format/WFSCapabilities/v1.js b/lib/OpenLayers/Format/WFSCapabilities/v1.js index bd52c61cea..65a5faa8a0 100644 --- a/lib/OpenLayers/Format/WFSCapabilities/v1.js +++ b/lib/OpenLayers/Format/WFSCapabilities/v1.js @@ -28,6 +28,16 @@ OpenLayers.Format.WFSCapabilities.v1 = OpenLayers.Class( ows: "http://www.opengis.net/ows" }, + + /** + * APIProperty: errorProperty + * {String} Which property of the returned object to check for in order to + * determine whether or not parsing has failed. In the case that the + * errorProperty is undefined on the returned object, the document will be + * run through an OGCExceptionReport parser. + */ + errorProperty: "featureTypeList", + /** * Property: defaultPrefix */ diff --git a/lib/OpenLayers/Format/XML/VersionedOGC.js b/lib/OpenLayers/Format/XML/VersionedOGC.js index 4aceee6988..c2cb97471b 100644 --- a/lib/OpenLayers/Format/XML/VersionedOGC.js +++ b/lib/OpenLayers/Format/XML/VersionedOGC.js @@ -45,14 +45,6 @@ OpenLayers.Format.XML.VersionedOGC = OpenLayers.Class(OpenLayers.Format.XML, { */ allowFallback: false, - /** - * APIProperty: errorProperty - * {String} Which property of the returned object to check for in order to - * determine whether or not parsing has failed. In the case that the - * errorProperty is undefined on the returned object, the document will be - * run through an OGCExceptionReport parser. - */ - errorProperty: null, /** * Property: name @@ -193,9 +185,13 @@ OpenLayers.Format.XML.VersionedOGC = OpenLayers.Class(OpenLayers.Format.XML, { } var root = data.documentElement; var version = this.getVersion(root); - this.parser = this.getParser(version); - var obj = this.parser.read(data, options); - if (this.errorProperty !== null && obj[this.errorProperty] === undefined) { + this.parser = this.getParser(version); // Select the parser + var obj = this.parser.read(data, options); // Parse the data + + var errorProperty = this.parser.errorProperty || null; + + + if (errorProperty !== null && obj[errorProperty] === undefined) { // an error must have happened, so parse it and report back var format = new OpenLayers.Format.OGCExceptionReport(); obj.error = format.read(data); diff --git a/tests/Format/WCSCapabilities/v1.html b/tests/Format/WCSCapabilities/v1.html index ac4096b335..646ca47f3e 100644 --- a/tests/Format/WCSCapabilities/v1.html +++ b/tests/Format/WCSCapabilities/v1.html @@ -30,7 +30,6 @@ var res = parser.read(text); - debugger; t.ok(!res.error, "Parsing XML generated no errors"); t.eq(res.service.fees, "mucho dinero", "Service>Fees correctly parsed"); @@ -64,8 +63,6 @@ res = parser.read(text); -debugger; - t.ok(!res.error, "Parsing XML generated no errors"); // ft = res.featureTypeList.featureTypes; From 809ecb1155716c5bb1afd17b0e622ac566b0b470 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Thu, 27 Dec 2012 13:47:16 +0100 Subject: [PATCH 06/50] Remove uneeded readers from WCS 1.0.0 --- .../Format/WCSCapabilities/v1_0_0.js | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index ca0799ac79..2fdd6d19df 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -46,7 +46,7 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( * run through an OGCExceptionReport parser. */ errorProperty: "service", - + /** * Property: readers @@ -188,30 +188,7 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( coverageOfferingBrief.lonLatEnvelope.max = max; } } - }, - - //////////////////////////////////////////////////////////////////////////////////////////// - - - "DCPType": function(node, obj) { - this.readChildNodes(node, obj); - }, - "HTTP": function(node, obj) { - this.readChildNodes(node, obj.href); - }, - "Get": function(node, obj) { - obj.get = node.getAttribute("onlineResource"); - }, - "Post": function(node, obj) { - obj.post = node.getAttribute("onlineResource"); - }, - "SRS": function(node, obj) { - var srs = this.getChildValue(node); - if (srs) { - obj.srs = srs; - } - } }, OpenLayers.Format.WCSCapabilities.v1.prototype.readers["wcs"]) }, From 5a19c74604fcebca64b39f286d625a79e6d2fcad Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Thu, 27 Dec 2012 13:47:37 +0100 Subject: [PATCH 07/50] Whitespace --- lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index 2fdd6d19df..f1f63f1de3 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -38,6 +38,7 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( ows: "http://www.opengis.net/ows" }, + /** * APIProperty: errorProperty * {String} Which property of the returned object to check for in order to From a8f1c7681107a5a7ef36096bd53e7d31f6eeb518 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Thu, 27 Dec 2012 13:48:38 +0100 Subject: [PATCH 08/50] Whitespace --- lib/OpenLayers/Format/XML/VersionedOGC.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/OpenLayers/Format/XML/VersionedOGC.js b/lib/OpenLayers/Format/XML/VersionedOGC.js index c2cb97471b..3561085e90 100644 --- a/lib/OpenLayers/Format/XML/VersionedOGC.js +++ b/lib/OpenLayers/Format/XML/VersionedOGC.js @@ -189,8 +189,6 @@ OpenLayers.Format.XML.VersionedOGC = OpenLayers.Class(OpenLayers.Format.XML, { var obj = this.parser.read(data, options); // Parse the data var errorProperty = this.parser.errorProperty || null; - - if (errorProperty !== null && obj[errorProperty] === undefined) { // an error must have happened, so parse it and report back var format = new OpenLayers.Format.OGCExceptionReport(); From be7c55f4325d9fd1da9cdc51344c55cfc6186352 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Thu, 27 Dec 2012 14:28:46 +0100 Subject: [PATCH 09/50] Added full suite of wcs 1.1.0 tests, all are passing --- .../Format/WCSCapabilities/v1_1_0.js | 11 +- tests/Format/WCSCapabilities/v1.html | 195 ++++-------------- 2 files changed, 46 insertions(+), 160 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index 7e2061afcb..cdd1db21f9 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -65,15 +65,14 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( }, "Contents": function(node, request) { - var contents = []; - this.readChildNodes(node, contents); - - request.contents = contents; + request.contents = []; + this.readChildNodes(node, request.contents); }, "CoverageSummary": function(node, contents) { - contents.coverageSummary = {}; - this.readChildNodes(node, contents.coverageSummary); + var coverageSummary = {}; + this.readChildNodes(node, coverageSummary); // Read the summary + contents.push(coverageSummary); // Add it to the contents array }, "Identifier": function(node, coverageSummary) { diff --git a/tests/Format/WCSCapabilities/v1.html b/tests/Format/WCSCapabilities/v1.html index 646ca47f3e..7579cdb98c 100644 --- a/tests/Format/WCSCapabilities/v1.html +++ b/tests/Format/WCSCapabilities/v1.html @@ -7,21 +7,21 @@ t.plan(1); var parser = new OpenLayers.Format.WCSCapabilities(); var text = '' + -'' + -' ' + -' Update error: Error occured updating features' + -' Second exception line' + -' ' + -''; + '' + + ' ' + + ' Update error: Error occured updating features' + + ' Second exception line' + + ' ' + + ''; var obj = parser.read(text); t.ok(!!obj.error, "Error reported correctly"); // The above should place an error in obj.error } function test_read(t) { - t.plan(26); // Number of tests performed: If you add a test below, be sure to increment this accordingly + t.plan(34); // Number of tests performed: If you add a test below, be sure to increment this accordingly var parser = new OpenLayers.Format.WCSCapabilities(); @@ -30,7 +30,6 @@ var res = parser.read(text); - t.ok(!res.error, "Parsing XML generated no errors"); t.eq(res.service.fees, "mucho dinero", "Service>Fees correctly parsed"); t.eq(res.service.accessConstraints, "Open to the public", "Service>AccessConstraints correctly parsed"); @@ -38,162 +37,50 @@ t.eq(res.service.keywords[0], "Geospatial WebServices", "Service>Keywords correctly parsed"); t.eq(res.service.label, "WCS Sample Data Server 1.0.0", "Service>Label correctly parsed"); t.eq(res.service.name, "MapServer WCS", "Service>Name correctly parsed"); - t.eq(res.service.responsibleParty.individualName, "Franko Lemmer", "Service>ResponsibleParty>IndividualName correctly parsed"); - t.eq(res.service.responsibleParty.organisationName, "CRP Henri Tudor", "Service>ResponsibleParty>OrganisationName correctly parsed"); - t.eq(res.service.responsibleParty.positionName, "R+D engineer", "Service>ResponsibleParty>PositionName correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.address.city, "Esch-sur-Alzette", "Service>responsibleParty>ContactInfo>Address>City correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.address.country, "Luxembourg", "Service>responsibleParty>ContactInfo>Address>Country correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.address.deliveryPoint, "66, rue de Luxembourg", "Service>responsibleParty>ContactInfo>Address>DeliveryPoint correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.address.electronicMailAddress, "franko.lemmer@flensburger.de", "Service>responsibleParty>ContactInfo>Address>ElectronicMailAddress correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.address.postalCode, "97202", "Service>responsibleParty>ContactInfo>Address>PostalCode correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.phone.facsimile, "6465955", "Service>responsibleParty>ContactInfo>Phone>Facsimile correctly parsed"); - t.eq(res.service.responsibleParty.contactInfo.phone.voice, "6463320", "Service>responsibleParty>ContactInfo>Phone>Voice correctly parsed"); + + var responsibleParty = res.service.responsibleParty; + t.eq(responsibleParty.individualName, "Franko Lemmer", "Service>ResponsibleParty>IndividualName correctly parsed"); + t.eq(responsibleParty.organisationName, "CRP Henri Tudor", "Service>ResponsibleParty>OrganisationName correctly parsed"); + t.eq(responsibleParty.positionName, "R+D engineer", "Service>ResponsibleParty>PositionName correctly parsed"); + t.eq(responsibleParty.contactInfo.address.city, "Esch-sur-Alzette", "Service>responsibleParty>ContactInfo>Address>City correctly parsed"); + t.eq(responsibleParty.contactInfo.address.country, "Luxembourg", "Service>responsibleParty>ContactInfo>Address>Country correctly parsed"); + t.eq(responsibleParty.contactInfo.address.deliveryPoint, "66, rue de Luxembourg", "Service>responsibleParty>ContactInfo>Address>DeliveryPoint correctly parsed"); + t.eq(responsibleParty.contactInfo.address.electronicMailAddress, "franko.lemmer@flensburger.de", "Service>responsibleParty>ContactInfo>Address>ElectronicMailAddress correctly parsed"); + t.eq(responsibleParty.contactInfo.address.postalCode, "97202", "Service>responsibleParty>ContactInfo>Address>PostalCode correctly parsed"); + t.eq(responsibleParty.contactInfo.phone.facsimile, "6465955", "Service>responsibleParty>ContactInfo>Phone>Facsimile correctly parsed"); + t.eq(responsibleParty.contactInfo.phone.voice, "6463320", "Service>responsibleParty>ContactInfo>Phone>Voice correctly parsed"); + + var metadata = res.contentMetadata[0]; + t.eq(metadata.name, "ro_dsm", "ContentMetadata>Name correctly parsed"); + t.eq(metadata.label, "Rotterdam DSM", "ContentMetadata>Label correctly parsed"); + t.eq(metadata.lonLatEnvelope.min.lat, "51.515151", "ContentMetadata>lonLatEnvelope>Min>Lat correctly parsed"); + t.eq(metadata.lonLatEnvelope.min.lon, "4.44444", "ContentMetadata>lonLatEnvelope>Min>Lon correctly parsed"); + t.eq(metadata.lonLatEnvelope.max.lat, "52.525252", "ContentMetadata>lonLatEnvelope>Max>Lat correctly parsed"); + t.eq(metadata.lonLatEnvelope.max.lon, "5.55555", "ContentMetadata>lonLatEnvelope>Max>Lon correctly parsed"); + t.eq(metadata.lonLatEnvelope.srsName, "urn:ogc:def:crs:OGC:1.3:CRS84", "ContentMetadata>lonLatEnvelope>SrsName correctly parsed"); t.eq(res.contentMetadata.length, 4, "Correct number of metadata records found"); - t.eq(res.contentMetadata[0].label, "Rotterdam DSM", "ContentMetadata>Label correctly parsed"); - t.eq(res.contentMetadata[0].lonLatEnvelope.min.lat, "51.515151", "ContentMetadata>lonLatEnvelope>Min>Lat correctly parsed"); - t.eq(res.contentMetadata[0].lonLatEnvelope.min.lon, "4.44444", "ContentMetadata>lonLatEnvelope>Min>Lon correctly parsed"); - t.eq(res.contentMetadata[0].lonLatEnvelope.max.lat, "52.525252", "ContentMetadata>lonLatEnvelope>Max>Lat correctly parsed"); - t.eq(res.contentMetadata[0].lonLatEnvelope.max.lon, "5.55555", "ContentMetadata>lonLatEnvelope>Max>Lon correctly parsed"); - t.eq(res.contentMetadata[0].lonLatEnvelope.srsName, "urn:ogc:def:crs:OGC:1.3:CRS84", "ContentMetadata>lonLatEnvelope>SrsName correctly parsed"); - t.eq(res.contentMetadata[0].name, "ro_dsm", "ContentMetadata>Name correctly parsed"); // GeoServer, v1.1.0 text = 'Web-Service Demo with data stored at TUDOR siteThis installation serves different Web-Service types (WMS, WFS) for testingGeospatial WebServicesKeyword OneKeyword Two!!OGC WCS1.1.0No fee!Unconstrained!CRP Henri TudorRoy DumerdeR+D engineer6463320646595566, rue de LuxembourgEsch-sur-Alzette97202Luxembourgflappy@tutones.com24/7by phoneGIS-AnalystWCS1.1.0WCS1.1.0ro_dsmro_dsm_miniro_irraro_irra_extWCS1.1.0ro_dsmro_dsm_miniro_irraro_irra_extNEAREST_NEIGHBOURBILINEARimage/tiffimage/pngimage/jpegimage/gifimage/png; mode=8bitfalseurn:ogc:def:crs:epsg::4326Rotterdam DSMDigital Surface Model (DSM) raster data set of inner city Rotterdam4.471333734139 51.9128134273834.4808508475645 51.9248713705576urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_dsmRotterdam sample DSM subsetThis a test data set of Rotterdams DSM subset4.47489346945755 51.91594537869274.47687824892444 51.9170706688033urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_dsm_miniRotterdam (Ljinbaan) solar irradiation data 2010This a result data set of a solar computation of Ljinbaan area. It shows the sum of kWh/a per sqmeter for 20104.471333734139 51.9128134273834.4808508475645 51.9248713705576urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_irraRotterdam (extended) solar irradiation data 2010This a result data set of a solar computation of extended Rotterdam area. It shows the sum of kWh/a per sqmeter for 20104.10024171314823 51.93597649928444.21909054278063 52.001415228243urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_irra_ext'; - res = parser.read(text); + // Most of the parsing is handled by other objects, so not much actually requires testing here t.ok(!res.error, "Parsing XML generated no errors"); - // ft = res.featureTypeList.featureTypes; - // t.eq(ft.length, 14, "number of feature types correct"); - // t.eq(ft[0]["abstract"], "Manhattan landmarks, identifies water, lakes, parks, interesting buildilngs", "abstract of first feature type correct"); - // t.eq(ft[0]["title"], "Manhattan (NY) landmarks", "title of first feature type correct"); - // t.eq(ft[0]["name"], "poly_landmarks", "name of first feature type correct"); - // t.eq(ft[0]["featureNS"], "http://www.census.gov", "ns of first feature type correct"); - // t.eq(ft[0]["srs"], "EPSG:4326", "srs of first feature type correct"); + t.eq(res.contents.length, 4, "number of features correct"); - // var service = res.service; - // t.eq(service.name, 'WFS', "service name correct"); - // t.eq(service.title, 'GeoServer Web Feature Service', "service title correct"); - // t.eq(service.abstract, 'This is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction.', "service title correct"); - // t.eq(service.keywords[0], 'WFS', "service keyword [0] correct"); - // t.eq(service.keywords[2], 'GEOSERVER', "service keyword [2] correct"); - // t.eq(service.onlineResource, 'http://localhost:80/geoserver/wfs', "service onlineresource correct"); - // t.ok(typeof service.fees == 'undefined', "service fees correct"); - // t.ok(typeof service.accessConstraints == 'undefined', "service accessconstraints correct"); - - // t.eq(res.capability.request.getfeature.href.post, "http://localhost:80/geoserver/wfs?", "getfeature request post href correct"); - // t.eq(res.capability.request.getfeature.href.get, "http://localhost:80/geoserver/wfs?request=GetFeature", "getfeature request get href correct"); - - // t.eq(res.capability.request.getfeature.formats[0], "GML2", "getfeature response format [0] correct"); - // t.eq(res.capability.request.getfeature.formats[4], "GML3", "getfeature response format [4] correct"); - - // // UMN Mapserer, v1.0.0 - // text = - // '' + - // '' + - // '' + - // '' + - // '' + - // '' + - // ' MapServer WFS' + - // ' GMap WMS Demo Server' + - // ' http://127.0.0.1/cgi-bin/mapserv_40?map=/msroot/apache/htdocs/gmap/htdocs/gmap75_wfs.map&service=WFS&' + - // '' + - // '' + - // '' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // '' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // '' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // '' + - // ' ' + - // ' ' + - // ' ' + - // '' + - // '' + - // '' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // '' + - // ' park' + - // ' Parks' + - // ' EPSG:42304' + - // ' ' + - // ' ' + - // ' ' + - // ' popplace' + - // '' + - // ' Cities' + - // ' EPSG:42304' + - // ' ' + - // ' ' + - // '' + - // '' + - // '' + - // ' ' + - // ' ' + - // '' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // ' ' + - // '' + - // '' + - // ''; - // res = parser.read(text); - // var ft = res.featureTypeList.featureTypes; - // t.eq(ft.length, 2, "number of feature types correct"); - // t.eq(ft[0]["title"], "Parks", "title of first feature type correct"); - // t.eq(ft[0]["name"], "park", "name of first feature type correct"); - // t.eq(ft[0]["srs"], "EPSG:42304", "srs of first feature type correct"); - - // var service = res.service; - // t.eq(service.name, 'MapServer WFS', "service name correct"); - // t.eq(service.title, 'GMap WMS Demo Server', "service title correct"); - // t.eq(service.onlineResource, 'http://127.0.0.1/cgi-bin/mapserv_40?map=/msroot/apache/htdocs/gmap/htdocs/gmap75_wfs.map&service=WFS&', "service onlineresource correct"); - // t.eq(res.capability.request.getfeature.href.get, "http://127.0.0.1/cgi-bin/mapserv_40?map=/msroot/apache/htdocs/gmap/htdocs/gmap75_wfs.map&service=WFS&", "getfeature request get href correct"); - // t.eq(res.capability.request.getfeature.formats[0], "GML2", "getfeature response format [0] correct"); + var contents = res.contents[0]; + t.eq(contents.identifier, "ro_dsm", "correct identifier"); + t.eq(contents.title, "Rotterdam DSM", "correct title"); + t.eq(contents.abstract, "Digital Surface Model (DSM) raster data set of inner city Rotterdam", "correct abstract"); + t.eq(contents.supportedFormat.length, 1, "correct number of supported formats"); + t.eq(contents.supportedFormat[0], "image/tiff", "correct format"); + t.eq(contents.supportedCRS.length, 4, "correct number of CRS records"); + t.eq(contents.supportedCRS[2], "urn:ogc:def:crs:EPSG::3857", "correct CRS"); } - - + From 0e9691c628bf439cbb9b1fa84ba72a4dac5a2bef Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Thu, 27 Dec 2012 14:40:28 +0100 Subject: [PATCH 10/50] Remove unused readers --- lib/OpenLayers/Format/WCSCapabilities/v1.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1.js b/lib/OpenLayers/Format/WCSCapabilities/v1.js index 89981f3f9d..c0d8d92b3c 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1.js @@ -71,18 +71,6 @@ OpenLayers.Format.WCSCapabilities.v1 = OpenLayers.Class( "wcs": { "WCS_Capabilities": function(node, obj) { // In 1.0.0, this was WCS_Capabilties, changed in 1.1.0 this.readChildNodes(node, obj); - }, - "Title": function(node, obj) { - var title = this.getChildValue(node); - if(title) { - obj.title = title; - } - }, - "Abstract": function(node, obj) { - var abst = this.getChildValue(node); - if(abst) { - obj["abstract"] = abst; - } } } }, From 16981a8afaf9478f0d30ffa00a0d927f9d2386f6 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Thu, 27 Dec 2012 15:38:01 +0100 Subject: [PATCH 11/50] Remove unneeded files --- lib/OpenLayers/Protocol/WCS.js | 86 ----- lib/OpenLayers/Protocol/WCS/v1.js | 434 -------------------------- lib/OpenLayers/Protocol/WCS/v1_0_0.js | 43 --- lib/OpenLayers/Protocol/WCS/v1_1_0.js | 37 --- 4 files changed, 600 deletions(-) delete mode 100644 lib/OpenLayers/Protocol/WCS.js delete mode 100644 lib/OpenLayers/Protocol/WCS/v1.js delete mode 100644 lib/OpenLayers/Protocol/WCS/v1_0_0.js delete mode 100644 lib/OpenLayers/Protocol/WCS/v1_1_0.js diff --git a/lib/OpenLayers/Protocol/WCS.js b/lib/OpenLayers/Protocol/WCS.js deleted file mode 100644 index 9520e3fbc0..0000000000 --- a/lib/OpenLayers/Protocol/WCS.js +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for - * full list of contributors). Published under the 2-clause BSD license. - * See license.txt in the OpenLayers distribution or repository for the - * full text of the license. */ - -/** - * @requires OpenLayers/Protocol.js - */ - -/** - * Class: OpenLayers.Protocol.WCS - * Used to create a versioned WCS protocol. Default version is 1.0.0. - * - * Returns: - * {} A WCS protocol of the given version. - * - * Example: - * (code) - * var protocol = new OpenLayers.Protocol.WCS({ - * version: "1.1.0", - * url: "http://demo.opengeo.org/geoserver/wcs", - * featureType: "tasmania_roads", - * featureNS: "http://www.openplans.org/topp", - * geometryName: "the_geom" - * }); - * (end) - * - * See the protocols for specific WCS versions for more detail. - */ -OpenLayers.Protocol.WCS = function(options) { - options = OpenLayers.Util.applyDefaults( - options, OpenLayers.Protocol.WCS.DEFAULTS - ); - var cls = OpenLayers.Protocol.WCS["v"+options.version.replace(/\./g, "_")]; - if(!cls) { - throw "Unsupported WCS version: " + options.version; - } - return new cls(options); -}; - -/** - * Function: fromWMSLayer - * Convenience function to create a WCS protocol from a WMS layer. This makes - * the assumption that a WCS requests can be issued at the same URL as - * WMS requests and that a WCS featureType exists with the same name as the - * WMS layer. - * - * This function is designed to auto-configure , , - * and for WCS 1.1.0. Note that - * srsName matching with the WMS layer will not work with WCS 1.0.0. - * - * Parameters: - * layer - {} WMS layer that has a matching WCS - * FeatureType at the same server url with the same typename. - * options - {Object} Default properties to be set on the protocol. - * - * Returns: - * {} - */ -OpenLayers.Protocol.WCS.fromWMSLayer = function(layer, options) { - var typeName, featurePrefix; - var param = layer.params["LAYERS"]; - var parts = (OpenLayers.Util.isArray(param) ? param[0] : param).split(":"); - if(parts.length > 1) { - featurePrefix = parts[0]; - } - typeName = parts.pop(); - var protocolOptions = { - url: layer.url, - featureType: typeName, - featurePrefix: featurePrefix, - srsName: layer.projection && layer.projection.getCode() || - layer.map && layer.map.getProjectionObject().getCode(), - version: "1.1.0" - }; - return new OpenLayers.Protocol.WCS(OpenLayers.Util.applyDefaults( - options, protocolOptions - )); -}; - -/** - * Constant: OpenLayers.Protocol.WCS.DEFAULTS - */ -OpenLayers.Protocol.WCS.DEFAULTS = { - "version": "1.0.0" -}; \ No newline at end of file diff --git a/lib/OpenLayers/Protocol/WCS/v1.js b/lib/OpenLayers/Protocol/WCS/v1.js deleted file mode 100644 index 894918461b..0000000000 --- a/lib/OpenLayers/Protocol/WCS/v1.js +++ /dev/null @@ -1,434 +0,0 @@ -/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for - * full list of contributors). Published under the 2-clause BSD license. - * See license.txt in the OpenLayers distribution or repository for the - * full text of the license. */ - -/** - * @requires OpenLayers/Protocol/WCS.js - */ - -/** - * Class: OpenLayers.Protocol.WCS.v1 - * Abstract class for for v1.0.0 and v1.1.0 protocol. - * - * Inherits from: - * - - */ -OpenLayers.Protocol.WCS.v1 = OpenLayers.Class(OpenLayers.Protocol, { - - /** - * Property: version - * {String} WCS version number. - */ - version: null, - - /** - * Property: srsName - * {String} Name of spatial reference system. Default is "EPSG:4326". - */ - srsName: "EPSG:4326", - - /** - * Property: featureType - * {String} Local feature typeName. - */ - featureType: null, - - /** - * Property: featureNS - * {String} Feature namespace. - */ - featureNS: null, - - /** - * Property: geometryName - * {String} Name of the geometry attribute for features. Default is - * "the_geom" for WCS 1.0, and null for higher versions. - */ - geometryName: "the_geom", - - /** - * Property: schema - * {String} Optional schema location that will be included in the - * schemaLocation attribute value. Note that the feature type schema - * is required for a strict XML validator (on transactions with an - * insert for example), but is *not* required by the WCS specification - * (since the server is supposed to know about feature type schemas). - */ - schema: null, - - /** - * Property: featurePrefix - * {String} Namespace alias for feature type. Default is "feature". - */ - featurePrefix: "feature", - - /** - * Property: formatOptions - * {Object} Optional options for the format. If a format is not provided, - * this property can be used to extend the default format options. - */ - formatOptions: null, - - /** - * Property: readFormat - */ - readFormat: null, - - /** - * Property: readOptions - * {Object} Optional object to pass to format's read. - */ - readOptions: null, - - /** - * Constructor: OpenLayers.Protocol.WCS - * A class for giving layers WCS protocol. - * - * Parameters: - * options - {Object} Optional object whose properties will be set on the - * instance. - * - * Valid options properties: - * url - {String} URL to send requests to (required). - * featureType - {String} Local (without prefix) feature typeName (required). - * featureNS - {String} Feature namespace (required, but can be autodetected - * during the first query if GML is used as readFormat and - * featurePrefix is provided and matches the prefix used by the server - * for this featureType). - * featurePrefix - {String} Feature namespace alias (optional - only used - * for writing if featureNS is provided). Default is 'feature'. - * geometryName - {String} Name of geometry attribute. The default is - * 'the_geom' for WCS 1.0, and null for higher versions. If - * null, it will be set to the name of the first geometry found in the - * first read operation. - * multi - {Boolean} If set to true, geometries will be casted to Multi - * geometries before they are written in a transaction. No casting will - * be done when reading features. - */ - initialize: function(options) { - OpenLayers.Protocol.prototype.initialize.apply(this, [options]); - - if (!options.geometryName && parseFloat(this.format.version) > 1.0) { - this.setGeometryName(null); - } - }, - - /** - * APIMethod: destroy - * Clean up the protocol. - */ - destroy: function() { - if(this.options && !this.options.format) { - this.format.destroy(); - } - this.format = null; - OpenLayers.Protocol.prototype.destroy.apply(this); - }, - - /** - * APIMethod: read - * Construct a request for reading new features. Since WCS splits the - * basic CRUD operations into GetFeature requests (for read) and - * Transactions (for all others), this method does not make use of the - * format's read method (that is only about reading transaction - * responses). - * - * Parameters: - * options - {Object} Options for the read operation, in addition to the - * options set on the instance (options set here will take precedence). - * - * To use a configured protocol to get e.g. a WCS hit count, applications - * could do the following: - * - * (code) - * protocol.read({ - * readOptions: {output: "object"}, - * resultType: "hits", - * maxFeatures: null, - * callback: function(resp) { - * // process resp.numberOfFeatures here - * } - * }); - * (end) - * - * To use a configured protocol to use WCS paging (if supported by the - * server), applications could do the following: - * - * (code) - * protocol.read({ - * startIndex: 0, - * count: 50 - * }); - * (end) - * - * To limit the attributes returned by the GetFeature request, applications - * can use the propertyNames option to specify the properties to include in - * the response: - * - * (code) - * protocol.read({ - * propertyNames: ["DURATION", "INTENSITY"] - * }); - * (end) - */ - read: function(options) { - OpenLayers.Protocol.prototype.read.apply(this, arguments); - options = OpenLayers.Util.extend({}, options); - OpenLayers.Util.applyDefaults(options, this.options || {}); - var response = new OpenLayers.Protocol.Response({requestType: "read"}); - - var data = OpenLayers.Format.XML.prototype.write.apply( - this.format, [this.format.writeNode("wcs:GetFeature", options)] - ); - - response.priv = OpenLayers.Request.POST({ - url: options.url, - callback: this.createCallback(this.handleRead, response, options), - params: options.params, - headers: options.headers, - data: data - }); - - return response; - }, - - /** - * APIMethod: setFeatureType - * Change the feature type on the fly. - * - * Parameters: - * featureType - {String} Local (without prefix) feature typeName. - */ - setFeatureType: function(featureType) { - this.featureType = featureType; - this.format.featureType = featureType; - }, - - /** - * APIMethod: setGeometryName - * Sets the geometryName option after instantiation. - * - * Parameters: - * geometryName - {String} Name of geometry attribute. - */ - setGeometryName: function(geometryName) { - this.geometryName = geometryName; - this.format.geometryName = geometryName; - }, - - /** - * Method: handleRead - * Deal with response from the read request. - * - * Parameters: - * response - {} The response object to pass - * to the user callback. - * options - {Object} The user options passed to the read call. - */ - handleRead: function(response, options) { - options = OpenLayers.Util.extend({}, options); - OpenLayers.Util.applyDefaults(options, this.options); - - if(options.callback) { - var request = response.priv; - if(request.status >= 200 && request.status < 300) { - // success - var result = this.parseResponse(request, options.readOptions); - if (result && result.success !== false) { - if (options.readOptions && options.readOptions.output == "object") { - OpenLayers.Util.extend(response, result); - } else { - response.features = result; - } - response.code = OpenLayers.Protocol.Response.SUCCESS; - } else { - // failure (service exception) - response.code = OpenLayers.Protocol.Response.FAILURE; - response.error = result; - } - } else { - // failure - response.code = OpenLayers.Protocol.Response.FAILURE; - } - options.callback.call(options.scope, response); - } - }, - - /** - * Method: parseResponse - * Read HTTP response body and return features - * - * Parameters: - * request - {XMLHttpRequest} The request object - * options - {Object} Optional object to pass to format's read - * - * Returns: - * {Object} or {Array({})} or - * {} - * An object with a features property, an array of features or a single - * feature. - */ - parseResponse: function(request, options) { - var doc = request.responseXML; - if(!doc || !doc.documentElement) { - doc = request.responseText; - } - if(!doc || doc.length <= 0) { - return null; - } - var result = (this.readFormat !== null) ? this.readFormat.read(doc) : - this.format.read(doc, options); - if (!this.featureNS) { - var format = this.readFormat || this.format; - this.featureNS = format.featureNS; - // no need to auto-configure again on subsequent reads - format.autoConfig = false; - if (!this.geometryName) { - this.setGeometryName(format.geometryName); - } - } - return result; - }, - - /** - * Method: commit - * Given a list of feature, assemble a batch request for update, create, - * and delete transactions. A commit call on the prototype amounts - * to writing a WCS transaction - so the write method on the format - * is used. - * - * Parameters: - * features - {Array()} - * options - {Object} - * - * Valid options properties: - * nativeElements - {Array({Object})} Array of objects with information for writing - * out elements, these objects have vendorId, safeToIgnore and - * value properties. The element is intended to allow access to - * vendor specific capabilities of any particular web feature server or - * datastore. - * - * Returns: - * {} A response object with a features - * property containing any insertIds and a priv property referencing - * the XMLHttpRequest object. - */ - commit: function(features, options) { - - options = OpenLayers.Util.extend({}, options); - OpenLayers.Util.applyDefaults(options, this.options); - - var response = new OpenLayers.Protocol.Response({ - requestType: "commit", - reqFeatures: features - }); - response.priv = OpenLayers.Request.POST({ - url: options.url, - headers: options.headers, - data: this.format.write(features, options), - callback: this.createCallback(this.handleCommit, response, options) - }); - - return response; - }, - - /** - * Method: handleCommit - * Called when the commit request returns. - * - * Parameters: - * response - {} The response object to pass - * to the user callback. - * options - {Object} The user options passed to the commit call. - */ - handleCommit: function(response, options) { - if(options.callback) { - var request = response.priv; - - // ensure that we have an xml doc - var data = request.responseXML; - if(!data || !data.documentElement) { - data = request.responseText; - } - - var obj = this.format.read(data) || {}; - - response.insertIds = obj.insertIds || []; - if (obj.success) { - response.code = OpenLayers.Protocol.Response.SUCCESS; - } else { - response.code = OpenLayers.Protocol.Response.FAILURE; - response.error = obj; - } - options.callback.call(options.scope, response); - } - }, - - /** - * Method: filterDelete - * Send a request that deletes all features by their filter. - * - * Parameters: - * filter - {} filter - */ - filterDelete: function(filter, options) { - options = OpenLayers.Util.extend({}, options); - OpenLayers.Util.applyDefaults(options, this.options); - - var response = new OpenLayers.Protocol.Response({ - requestType: "commit" - }); - - var root = this.format.createElementNSPlus("wcs:Transaction", { - attributes: { - service: "WCS", - version: this.version - } - }); - - var deleteNode = this.format.createElementNSPlus("wcs:Delete", { - attributes: { - typeName: (options.featureNS ? this.featurePrefix + ":" : "") + - options.featureType - } - }); - - if(options.featureNS) { - deleteNode.setAttribute("xmlns:" + this.featurePrefix, options.featureNS); - } - var filterNode = this.format.writeNode("ogc:Filter", filter); - - deleteNode.appendChild(filterNode); - - root.appendChild(deleteNode); - - var data = OpenLayers.Format.XML.prototype.write.apply( - this.format, [root] - ); - - return OpenLayers.Request.POST({ - url: this.url, - callback : options.callback || function(){}, - data: data - }); - - }, - - /** - * Method: abort - * Abort an ongoing request, the response object passed to - * this method must come from this protocol (as a result - * of a read, or commit operation). - * - * Parameters: - * response - {} - */ - abort: function(response) { - if (response) { - response.priv.abort(); - } - }, - - CLASS_NAME: "OpenLayers.Protocol.WCS.v1" -}); diff --git a/lib/OpenLayers/Protocol/WCS/v1_0_0.js b/lib/OpenLayers/Protocol/WCS/v1_0_0.js deleted file mode 100644 index 54a5b8b3a2..0000000000 --- a/lib/OpenLayers/Protocol/WCS/v1_0_0.js +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for - * full list of contributors). Published under the 2-clause BSD license. - * See license.txt in the OpenLayers distribution or repository for the - * full text of the license. */ - -/** - * @requires OpenLayers/Protocol/WCS/v1.js - */ - -/** - * Class: OpenLayers.Protocol.WCS.v1_0_0 - * A WCS v1.0.0 protocol for vector layers. Create a new instance with the - * constructor. - * - * Inherits from: - * - - */ -OpenLayers.Protocol.WCS.v1_0_0 = OpenLayers.Class(OpenLayers.Protocol.WCS.v1, { - - /** - * Property: version - * {String} WCS version number. - */ - version: "1.0.0", - - /** - * Constructor: OpenLayers.Protocol.WCS.v1_0_0 - * A class for giving layers WCS v1.0.0 protocol. - * - * Parameters: - * options - {Object} Optional object whose properties will be set on the - * instance. - * - * Valid options properties: - * featureType - {String} Local (without prefix) feature typeName (required). - * featureNS - {String} Feature namespace (optional). - * featurePrefix - {String} Feature namespace alias (optional - only used - * if featureNS is provided). Default is 'feature'. - * geometryName - {String} Name of geometry attribute. Default is 'the_geom'. - */ - - CLASS_NAME: "OpenLayers.Protocol.WCS.v1_0_0" -}); \ No newline at end of file diff --git a/lib/OpenLayers/Protocol/WCS/v1_1_0.js b/lib/OpenLayers/Protocol/WCS/v1_1_0.js deleted file mode 100644 index 05b86f11e8..0000000000 --- a/lib/OpenLayers/Protocol/WCS/v1_1_0.js +++ /dev/null @@ -1,37 +0,0 @@ -/* ====================================================================== - OpenLayers/Protocol/WCS/v1_1_0.js - ====================================================================== */ - -/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for - * full list of contributors). Published under the 2-clause BSD license. - * See license.txt in the OpenLayers distribution or repository for the - * full text of the license. */ - -/** - * @requires OpenLayers/Protocol/WCS/v1.js - */ - -/** - * Class: OpenLayers.Protocol.WCS.v1_1_0 - * A WCS v1.1.0 protocol for vector layers. Create a new instance with the - * constructor. - * - * Differences from the v1.0.0 protocol: - * - uses Filter Encoding 1.1.0 instead of 1.0.0 - * - uses GML 3 instead of 2 if no format is provided - * - * Inherits from: - * - - */ -OpenLayers.Protocol.WCS.v1_1_0 = OpenLayers.Class(OpenLayers.Protocol.WCS.v1, { - - /** - * Property: version - * {String} WCS version number. - */ - version: "1.1.0", - - - - CLASS_NAME: "OpenLayers.Protocol.WCS.v1_1_0" -}); From 49ff1b44ea35ff527f0c96d5a7a75a6507ae7fbd Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Thu, 27 Dec 2012 15:43:33 +0100 Subject: [PATCH 12/50] Whitespace --- lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index cdd1db21f9..a2c3a50d20 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -63,30 +63,24 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( "Capabilities": function(node, obj) { // In 1.0.0, this was WCS_Capabilties, in 1.1.0, it's just Capabilities this.readChildNodes(node, obj); }, - "Contents": function(node, request) { request.contents = []; this.readChildNodes(node, request.contents); }, - "CoverageSummary": function(node, contents) { var coverageSummary = {}; this.readChildNodes(node, coverageSummary); // Read the summary contents.push(coverageSummary); // Add it to the contents array }, - "Identifier": function(node, coverageSummary) { coverageSummary.identifier = this.getChildValue(node); }, - "Title": function(node, coverageSummary) { coverageSummary.title = this.getChildValue(node); }, - "Abstract": function(node, coverageSummary) { coverageSummary.abstract = this.getChildValue(node); }, - "SupportedCRS": function(node, coverageSummary) { var crs = this.getChildValue(node); if(crs) { @@ -96,7 +90,6 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( coverageSummary["supportedCRS"].push(crs); } }, - "SupportedFormat": function(node, coverageSummary) { var format = this.getChildValue(node); if(format) { @@ -107,7 +100,6 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( } }, - }, OpenLayers.Format.WCSCapabilities.v1.prototype.readers["wcs"]), "ows": OpenLayers.Format.OWSCommon.v1.prototype.readers["ows"] }, From 700b036c1b10c2ccc0fcb5a172f1f44d7a954a32 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 12:09:45 +0100 Subject: [PATCH 13/50] Remove unneeded WCS protocol lines --- lib/OpenLayers.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index 711ab6606c..7e2d6e4bda 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -281,9 +281,6 @@ "OpenLayers/Protocol.js", "OpenLayers/Protocol/HTTP.js", "OpenLayers/Protocol/WCS.js", - "OpenLayers/Protocol/WCS/v1.js", - "OpenLayers/Protocol/WCS/v1_0_0.js", - "OpenLayers/Protocol/WCS/v1_1_0.js", "OpenLayers/Protocol/WFS.js", "OpenLayers/Protocol/WFS/v1.js", "OpenLayers/Protocol/WFS/v1_0_0.js", From 543a5f68817b592afc523bba5e3f7581b8217494 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 12:10:54 +0100 Subject: [PATCH 14/50] Remove line break --- lib/OpenLayers/Format/WCSCapabilities.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities.js b/lib/OpenLayers/Format/WCSCapabilities.js index 082805602c..2a6030317c 100644 --- a/lib/OpenLayers/Format/WCSCapabilities.js +++ b/lib/OpenLayers/Format/WCSCapabilities.js @@ -21,7 +21,6 @@ OpenLayers.Format.WCSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Versi * {String} Version number to assume if none found. Default is "1.1.0". */ defaultVersion: "1.1.0", - /** * Constructor: OpenLayers.Format.WCSCapabilities From e40034521b3208d4ee03c113ea8b4dd9dbc1bede Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 12:12:04 +0100 Subject: [PATCH 15/50] Comments --- lib/OpenLayers/Format/WCSCapabilities.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities.js b/lib/OpenLayers/Format/WCSCapabilities.js index 2a6030317c..da7d13c465 100644 --- a/lib/OpenLayers/Format/WCSCapabilities.js +++ b/lib/OpenLayers/Format/WCSCapabilities.js @@ -33,13 +33,13 @@ OpenLayers.Format.WCSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Versi /** * APIMethod: read - * Read capabilities data from a string, and return a list of layers. + * Read capabilities data from a string, and return a list of coverages. * * Parameters: * data - {String} or {DOMElement} data to read/parse. * * Returns: - * {Array} List of named layers. + * {Array} List of named coverages. */ CLASS_NAME: "OpenLayers.Format.WCSCapabilities" From b076dd8041ce348aff8e1149c48571fa4c3d97d4 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 12:14:19 +0100 Subject: [PATCH 16/50] Remove comment block referring to constructor -- not needed for abstract class --- lib/OpenLayers/Format/WCSCapabilities/v1.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1.js b/lib/OpenLayers/Format/WCSCapabilities/v1.js index c0d8d92b3c..3897881841 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1.js @@ -26,15 +26,6 @@ OpenLayers.Format.WCSCapabilities.v1 = OpenLayers.Class( * Property: defaultPrefix */ defaultPrefix: "wcs", - - /** - * Constructor: OpenLayers.Format.WCSCapabilities.v1_1 - * Create an instance of one of the subclasses. - * - * Parameters: - * options - {Object} An optional object whose properties will be set on - * this instance. - */ /** * APIMethod: read From 0a639404c42407356dd7d5ec6606f57d66caed27 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 12:26:13 +0100 Subject: [PATCH 17/50] Convert APIProperty to Property --- lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index f1f63f1de3..fe6ac248ad 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -40,7 +40,7 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( /** - * APIProperty: errorProperty + * Property: errorProperty * {String} Which property of the returned object to check for in order to * determine whether or not parsing has failed. In the case that the * errorProperty is undefined on the returned object, the document will be From 57e833d71f3788a27ffa3ef3578bdf69148d4cd3 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 12:26:51 +0100 Subject: [PATCH 18/50] Move comment to shorten line --- lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index fe6ac248ad..eed4edd9c3 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -74,7 +74,8 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( this.readChildNodes(node, service.keywords); }, "keyword": function(node, keywords) { - keywords.push(this.getChildValue(node)); // Append the keyword to the keywords list + // Append the keyword to the keywords list + keywords.push(this.getChildValue(node)); }, "responsibleParty": function(node, service) { service.responsibleParty = {}; From 5f2c3803f42238782a2d0d5d57e8d794e57d0cdd Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 12:42:28 +0100 Subject: [PATCH 19/50] Correct comment about inheritance --- lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index a2c3a50d20..017fea96dc 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -13,7 +13,7 @@ * Read WCS Capabilities version 1.1.0. * * Inherits from: - * - + * - */ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( OpenLayers.Format.WCSCapabilities.v1, { From d3345a58b1d68d9d52d468e8e1e6ce631e0e473c Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 12:42:56 +0100 Subject: [PATCH 20/50] Whitespace --- lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index 017fea96dc..2eca8e7fe6 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -39,7 +39,6 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( */ errorProperty: "operationsMetadata", - /** * Constructor: OpenLayers.Format.WCSCapabilities.v1_1_0 * Create a new parser for WCS capabilities version 1.1.0. From f7605dcb669a779575d3566924f86e11bca7a0b2 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 12:44:57 +0100 Subject: [PATCH 21/50] Reformat to 80 cols --- lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index 2eca8e7fe6..efa4a7d15e 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -59,7 +59,8 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( readers: { "wcs": OpenLayers.Util.applyDefaults({ - "Capabilities": function(node, obj) { // In 1.0.0, this was WCS_Capabilties, in 1.1.0, it's just Capabilities + // In 1.0.0, this was WCS_Capabilties, in 1.1.0, it's Capabilities + "Capabilities": function(node, obj) { this.readChildNodes(node, obj); }, "Contents": function(node, request) { @@ -68,8 +69,11 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( }, "CoverageSummary": function(node, contents) { var coverageSummary = {}; - this.readChildNodes(node, coverageSummary); // Read the summary - contents.push(coverageSummary); // Add it to the contents array + // Read the summary: + this.readChildNodes(node, coverageSummary); + + // Add it to the contents array: + contents.push(coverageSummary); }, "Identifier": function(node, coverageSummary) { coverageSummary.identifier = this.getChildValue(node); From 15138605c36224eb268d7f58da098a7936a28aa8 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 12:48:55 +0100 Subject: [PATCH 22/50] Rename contents to contentMetadata to maintain some sort of continuity between WCS 1.0.0 and 1.1.0 --- lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index efa4a7d15e..8dcb5f5e2f 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -64,14 +64,14 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( this.readChildNodes(node, obj); }, "Contents": function(node, request) { - request.contents = []; - this.readChildNodes(node, request.contents); + request.contentMetadata = []; + this.readChildNodes(node, request.contentMetadata); }, "CoverageSummary": function(node, contents) { var coverageSummary = {}; // Read the summary: this.readChildNodes(node, coverageSummary); - + // Add it to the contents array: contents.push(coverageSummary); }, From 008c7d582eb67ad73f0fd918123227e6960c335d Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 12:51:52 +0100 Subject: [PATCH 23/50] Update test to reflect changes in last commit --- .../Format/WCSCapabilities/v1_1_0.js | 6 +++--- tests/Format/WCSCapabilities/v1.html | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index 8dcb5f5e2f..5098d14a49 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -67,13 +67,13 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( request.contentMetadata = []; this.readChildNodes(node, request.contentMetadata); }, - "CoverageSummary": function(node, contents) { + "CoverageSummary": function(node, contentMetadata) { var coverageSummary = {}; // Read the summary: this.readChildNodes(node, coverageSummary); - // Add it to the contents array: - contents.push(coverageSummary); + // Add it to the contentMetadata array: + contentMetadata.push(coverageSummary); }, "Identifier": function(node, coverageSummary) { coverageSummary.identifier = this.getChildValue(node); diff --git a/tests/Format/WCSCapabilities/v1.html b/tests/Format/WCSCapabilities/v1.html index 7579cdb98c..c38dd7256b 100644 --- a/tests/Format/WCSCapabilities/v1.html +++ b/tests/Format/WCSCapabilities/v1.html @@ -68,16 +68,16 @@ // Most of the parsing is handled by other objects, so not much actually requires testing here t.ok(!res.error, "Parsing XML generated no errors"); - t.eq(res.contents.length, 4, "number of features correct"); + t.eq(res.contentMetadata.length, 4, "number of features correct"); - var contents = res.contents[0]; - t.eq(contents.identifier, "ro_dsm", "correct identifier"); - t.eq(contents.title, "Rotterdam DSM", "correct title"); - t.eq(contents.abstract, "Digital Surface Model (DSM) raster data set of inner city Rotterdam", "correct abstract"); - t.eq(contents.supportedFormat.length, 1, "correct number of supported formats"); - t.eq(contents.supportedFormat[0], "image/tiff", "correct format"); - t.eq(contents.supportedCRS.length, 4, "correct number of CRS records"); - t.eq(contents.supportedCRS[2], "urn:ogc:def:crs:EPSG::3857", "correct CRS"); + var metadata = res.contentMetadata[0]; + t.eq(metadata.identifier, "ro_dsm", "correct identifier"); + t.eq(metadata.title, "Rotterdam DSM", "correct title"); + t.eq(metadata.abstract, "Digital Surface Model (DSM) raster data set of inner city Rotterdam", "correct abstract"); + t.eq(metadata.supportedFormat.length, 1, "correct number of supported formats"); + t.eq(metadata.supportedFormat[0], "image/tiff", "correct format"); + t.eq(metadata.supportedCRS.length, 4, "correct number of CRS records"); + t.eq(metadata.supportedCRS[2], "urn:ogc:def:crs:EPSG::3857", "correct CRS"); } From a8ae30079e60e6e5a31d3e0d0c4d638fd9d8e230 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 13:01:45 +0100 Subject: [PATCH 24/50] Forgot this somehow... the missing WCS.js file --- lib/OpenLayers/Protocol/WCS.js | 86 ++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 lib/OpenLayers/Protocol/WCS.js diff --git a/lib/OpenLayers/Protocol/WCS.js b/lib/OpenLayers/Protocol/WCS.js new file mode 100644 index 0000000000..9520e3fbc0 --- /dev/null +++ b/lib/OpenLayers/Protocol/WCS.js @@ -0,0 +1,86 @@ +/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the 2-clause BSD license. + * See license.txt in the OpenLayers distribution or repository for the + * full text of the license. */ + +/** + * @requires OpenLayers/Protocol.js + */ + +/** + * Class: OpenLayers.Protocol.WCS + * Used to create a versioned WCS protocol. Default version is 1.0.0. + * + * Returns: + * {} A WCS protocol of the given version. + * + * Example: + * (code) + * var protocol = new OpenLayers.Protocol.WCS({ + * version: "1.1.0", + * url: "http://demo.opengeo.org/geoserver/wcs", + * featureType: "tasmania_roads", + * featureNS: "http://www.openplans.org/topp", + * geometryName: "the_geom" + * }); + * (end) + * + * See the protocols for specific WCS versions for more detail. + */ +OpenLayers.Protocol.WCS = function(options) { + options = OpenLayers.Util.applyDefaults( + options, OpenLayers.Protocol.WCS.DEFAULTS + ); + var cls = OpenLayers.Protocol.WCS["v"+options.version.replace(/\./g, "_")]; + if(!cls) { + throw "Unsupported WCS version: " + options.version; + } + return new cls(options); +}; + +/** + * Function: fromWMSLayer + * Convenience function to create a WCS protocol from a WMS layer. This makes + * the assumption that a WCS requests can be issued at the same URL as + * WMS requests and that a WCS featureType exists with the same name as the + * WMS layer. + * + * This function is designed to auto-configure , , + * and for WCS 1.1.0. Note that + * srsName matching with the WMS layer will not work with WCS 1.0.0. + * + * Parameters: + * layer - {} WMS layer that has a matching WCS + * FeatureType at the same server url with the same typename. + * options - {Object} Default properties to be set on the protocol. + * + * Returns: + * {} + */ +OpenLayers.Protocol.WCS.fromWMSLayer = function(layer, options) { + var typeName, featurePrefix; + var param = layer.params["LAYERS"]; + var parts = (OpenLayers.Util.isArray(param) ? param[0] : param).split(":"); + if(parts.length > 1) { + featurePrefix = parts[0]; + } + typeName = parts.pop(); + var protocolOptions = { + url: layer.url, + featureType: typeName, + featurePrefix: featurePrefix, + srsName: layer.projection && layer.projection.getCode() || + layer.map && layer.map.getProjectionObject().getCode(), + version: "1.1.0" + }; + return new OpenLayers.Protocol.WCS(OpenLayers.Util.applyDefaults( + options, protocolOptions + )); +}; + +/** + * Constant: OpenLayers.Protocol.WCS.DEFAULTS + */ +OpenLayers.Protocol.WCS.DEFAULTS = { + "version": "1.0.0" +}; \ No newline at end of file From abd733865bfd28a232a39c6a3223481f94acabe3 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 13:21:43 +0100 Subject: [PATCH 25/50] Reference OWS 1.1.0 readers --- lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index 5098d14a49..e8be41bfc7 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -104,7 +104,7 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( }, }, OpenLayers.Format.WCSCapabilities.v1.prototype.readers["wcs"]), - "ows": OpenLayers.Format.OWSCommon.v1.prototype.readers["ows"] + "ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"], }, CLASS_NAME: "OpenLayers.Format.WCSCapabilities.v1_1_0" From eb4bbff8f47a88f999aee923c2ce8a311fe9533b Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 13:25:15 +0100 Subject: [PATCH 26/50] Reinstate deleted comment block --- lib/OpenLayers/Format/XML/VersionedOGC.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/OpenLayers/Format/XML/VersionedOGC.js b/lib/OpenLayers/Format/XML/VersionedOGC.js index 3561085e90..178840a459 100644 --- a/lib/OpenLayers/Format/XML/VersionedOGC.js +++ b/lib/OpenLayers/Format/XML/VersionedOGC.js @@ -45,6 +45,14 @@ OpenLayers.Format.XML.VersionedOGC = OpenLayers.Class(OpenLayers.Format.XML, { */ allowFallback: false, + /** + * APIProperty: errorProperty + * {String} Which property of the returned object to check for in order to + * determine whether or not parsing has failed. In the case that the + * errorProperty is undefined on the returned object, the document will be + * run through an OGCExceptionReport parser. + */ + errorProperty: null, /** * Property: name From 37fd98bb032340975918115ee4ba5c7c25772db7 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 13:41:34 +0100 Subject: [PATCH 27/50] Move WCS_Capabilities reader into v_1_0_0 class --- lib/OpenLayers/Format/WCSCapabilities/v1.js | 15 --------------- lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js | 3 +++ lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 1 - 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1.js b/lib/OpenLayers/Format/WCSCapabilities/v1.js index 3897881841..d0dc4326c2 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1.js @@ -50,21 +50,6 @@ OpenLayers.Format.WCSCapabilities.v1 = OpenLayers.Class( return capabilities; }, - /** - * Property: readers - * Contains public functions, grouped by namespace prefix, that will - * be applied when a namespaced node is found matching the function - * name. The function will be applied in the scope of this parser - * with two arguments: the node being read and a context object passed - * from the parent. - */ - readers: { - "wcs": { - "WCS_Capabilities": function(node, obj) { // In 1.0.0, this was WCS_Capabilties, changed in 1.1.0 - this.readChildNodes(node, obj); - } - } - }, CLASS_NAME: "OpenLayers.Format.WCSCapabilities.v1" diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index eed4edd9c3..efc02fe088 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -59,6 +59,9 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( */ readers: { "wcs": OpenLayers.Util.applyDefaults({ + "WCS_Capabilities": function(node, obj) { + this.readChildNodes(node, obj); + }, "Service": function(node, obj) { obj.service = {}; this.readChildNodes(node, obj.service); diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index e8be41bfc7..5adb7bf247 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -58,7 +58,6 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( */ readers: { "wcs": OpenLayers.Util.applyDefaults({ - // In 1.0.0, this was WCS_Capabilties, in 1.1.0, it's Capabilities "Capabilities": function(node, obj) { this.readChildNodes(node, obj); From b15c751808b0ace45b42a03a51c525573aaa5611 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 14:21:30 +0100 Subject: [PATCH 28/50] Reuse GML pos reader -- something looks not quite right here, but it does work --- .../Format/WCSCapabilities/v1_0_0.js | 52 +++++-------------- tests/Format/WCSCapabilities/v1.html | 9 ++-- 2 files changed, 19 insertions(+), 42 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index efc02fe088..017a6fec41 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -147,51 +147,27 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( "label": function(node, coverageOfferingBrief) { coverageOfferingBrief.label = this.getChildValue(node); }, + // "lonLatEnvelope": function(node, coverageOfferingBrief) { + // debugger + // var bbox = OpenLayers.Format.GML.v3.prototype.readers["gml"].pos.apply(this, [node, coverageOfferingBrief]); + // bbox.srs = node.getAttribute("srsName"); + // coverageOfferingBrief.lonLatEnvelope[bbox.srs] = bbox; + // }, "lonLatEnvelope": function(node, coverageOfferingBrief) { - - // Look for . Only write the data if everything parsed neatly. - // This works well for the data samples I have access to, but may need to be generalized to cover other possible use cases. var nodeList = this.getElementsByTagNameNS(node, "http://www.opengis.net/gml", "pos"); // We expect two nodes here, to create the corners of a bounding box if(nodeList.length == 2) { - var min = {}, - max = {}; + var min = {}; + var max = {}; - var ok = true; + OpenLayers.Format.GML.v3.prototype.readers["gml"].pos.apply(this, [nodeList[0], min]); + OpenLayers.Format.GML.v3.prototype.readers["gml"].pos.apply(this, [nodeList[1], max]); - // min - var coordString = nodeList[0].firstChild.nodeValue; - - coordString = coordString.replace(this.regExes.trimSpace, ""); - var coords = coordString.split(this.regExes.splitSpace); - - if(coords.length == 2) { - min.lon = coords[0]; - min.lat = coords[1]; - } else { - ok = false; - } - - // max - var coordString = nodeList[1].firstChild.nodeValue; - - coordString = coordString.replace(this.regExes.trimSpace, ""); - var coords = coordString.split(this.regExes.splitSpace); - - if(coords.length == 2) { - max.lon = coords[0]; - max.lat = coords[1]; - } else { - ok = false; - } - - if(ok) { - coverageOfferingBrief.lonLatEnvelope = {}; - coverageOfferingBrief.lonLatEnvelope.srsName = node.getAttribute("srsName"); - coverageOfferingBrief.lonLatEnvelope.min = min; - coverageOfferingBrief.lonLatEnvelope.max = max; - } + coverageOfferingBrief.lonLatEnvelope = {}; + coverageOfferingBrief.lonLatEnvelope.srsName = node.getAttribute("srsName"); + coverageOfferingBrief.lonLatEnvelope.min = min.points[0]; + coverageOfferingBrief.lonLatEnvelope.max = max.points[0]; } }, }, OpenLayers.Format.WCSCapabilities.v1.prototype.readers["wcs"]) diff --git a/tests/Format/WCSCapabilities/v1.html b/tests/Format/WCSCapabilities/v1.html index c38dd7256b..4a713cd491 100644 --- a/tests/Format/WCSCapabilities/v1.html +++ b/tests/Format/WCSCapabilities/v1.html @@ -51,12 +51,13 @@ t.eq(responsibleParty.contactInfo.phone.voice, "6463320", "Service>responsibleParty>ContactInfo>Phone>Voice correctly parsed"); var metadata = res.contentMetadata[0]; + t.eq(metadata.name, "ro_dsm", "ContentMetadata>Name correctly parsed"); t.eq(metadata.label, "Rotterdam DSM", "ContentMetadata>Label correctly parsed"); - t.eq(metadata.lonLatEnvelope.min.lat, "51.515151", "ContentMetadata>lonLatEnvelope>Min>Lat correctly parsed"); - t.eq(metadata.lonLatEnvelope.min.lon, "4.44444", "ContentMetadata>lonLatEnvelope>Min>Lon correctly parsed"); - t.eq(metadata.lonLatEnvelope.max.lat, "52.525252", "ContentMetadata>lonLatEnvelope>Max>Lat correctly parsed"); - t.eq(metadata.lonLatEnvelope.max.lon, "5.55555", "ContentMetadata>lonLatEnvelope>Max>Lon correctly parsed"); + t.eq(metadata.lonLatEnvelope.min.x, 51.515151, "ContentMetadata>lonLatEnvelope>Min>Lat correctly parsed"); + t.eq(metadata.lonLatEnvelope.min.y, 4.44444, "ContentMetadata>lonLatEnvelope>Min>Lon correctly parsed"); + t.eq(metadata.lonLatEnvelope.max.x, 52.525252, "ContentMetadata>lonLatEnvelope>Max>Lat correctly parsed"); + t.eq(metadata.lonLatEnvelope.max.y, 5.55555, "ContentMetadata>lonLatEnvelope>Max>Lon correctly parsed"); t.eq(metadata.lonLatEnvelope.srsName, "urn:ogc:def:crs:OGC:1.3:CRS84", "ContentMetadata>lonLatEnvelope>SrsName correctly parsed"); t.eq(res.contentMetadata.length, 4, "Correct number of metadata records found"); From f06931b1b7bc13c4a7fa1e4e377572b3c0a127b6 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 14:32:02 +0100 Subject: [PATCH 29/50] Update source of sample XML --- tests/Format/WCSCapabilities/v1.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Format/WCSCapabilities/v1.html b/tests/Format/WCSCapabilities/v1.html index 4a713cd491..180edc7d9f 100644 --- a/tests/Format/WCSCapabilities/v1.html +++ b/tests/Format/WCSCapabilities/v1.html @@ -25,7 +25,7 @@ var parser = new OpenLayers.Format.WCSCapabilities(); - // GeoServer, v1.0.0 + // MapServer, v1.0.0 var text = 'MapServer WCSGeospatial WebServicesLuxembourg!Franko LemmerCRP Henri TudorR+D engineer64633206465955
    66, rue de LuxembourgEsch-sur-Alzette97202Luxembourgfranko.lemmer@flensburger.de
    mucho dineroOpen to the public
    application/vnd.ogc.se_xmlro_dsm4.44444 51.5151515.55555 52.525252ro_dsm_mini4.47489346945755 51.91594537869274.47687824892444 51.9170706688033ro_irra4.471333734139 51.9128134273834.4808508475645 51.9248713705576ro_irra_ext4.10024171314823 51.93597649928444.21909054278063 52.001415228243
    '; var res = parser.read(text); @@ -62,7 +62,7 @@ t.eq(res.contentMetadata.length, 4, "Correct number of metadata records found"); - // GeoServer, v1.1.0 + // MapServer, v1.1.0 text = 'Web-Service Demo with data stored at TUDOR siteThis installation serves different Web-Service types (WMS, WFS) for testingGeospatial WebServicesKeyword OneKeyword Two!!OGC WCS1.1.0No fee!Unconstrained!CRP Henri TudorRoy DumerdeR+D engineer6463320646595566, rue de LuxembourgEsch-sur-Alzette97202Luxembourgflappy@tutones.com24/7by phoneGIS-AnalystWCS1.1.0WCS1.1.0ro_dsmro_dsm_miniro_irraro_irra_extWCS1.1.0ro_dsmro_dsm_miniro_irraro_irra_extNEAREST_NEIGHBOURBILINEARimage/tiffimage/pngimage/jpegimage/gifimage/png; mode=8bitfalseurn:ogc:def:crs:epsg::4326Rotterdam DSMDigital Surface Model (DSM) raster data set of inner city Rotterdam4.471333734139 51.9128134273834.4808508475645 51.9248713705576urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_dsmRotterdam sample DSM subsetThis a test data set of Rotterdams DSM subset4.47489346945755 51.91594537869274.47687824892444 51.9170706688033urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_dsm_miniRotterdam (Ljinbaan) solar irradiation data 2010This a result data set of a solar computation of Ljinbaan area. It shows the sum of kWh/a per sqmeter for 20104.471333734139 51.9128134273834.4808508475645 51.9248713705576urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_irraRotterdam (extended) solar irradiation data 2010This a result data set of a solar computation of extended Rotterdam area. It shows the sum of kWh/a per sqmeter for 20104.10024171314823 51.93597649928444.21909054278063 52.001415228243urn:ogc:def:crs:EPSG::28992urn:ogc:def:crs:EPSG::900913urn:ogc:def:crs:EPSG::3857urn:ogc:def:crs:EPSG::4326image/tiffro_irra_ext'; res = parser.read(text); From ddc6bd817d0805a68d6af32080d2cc766b28b558 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 14:36:04 +0100 Subject: [PATCH 30/50] Prefer dot notation --- lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index 5adb7bf247..be09e874c3 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -86,19 +86,19 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( "SupportedCRS": function(node, coverageSummary) { var crs = this.getChildValue(node); if(crs) { - if(!coverageSummary["supportedCRS"]) { - coverageSummary["supportedCRS"] = []; + if(!coverageSummary.supportedCRS) { + coverageSummary.supportedCRS = []; } - coverageSummary["supportedCRS"].push(crs); + coverageSummary.supportedCRS.push(crs); } }, "SupportedFormat": function(node, coverageSummary) { var format = this.getChildValue(node); if(format) { - if(!coverageSummary["supportedFormat"]) { - coverageSummary["supportedFormat"] = []; + if(!coverageSummary.supportedFormat) { + coverageSummary.supportedFormat = []; } - coverageSummary["supportedFormat"].push(format); + coverageSummary.supportedFormat.push(format); } }, From 8193f309dc9c8d434e4244085496e65edc7b7165 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 15:28:31 +0100 Subject: [PATCH 31/50] Update comment/documentation --- lib/OpenLayers/Format/XML/VersionedOGC.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/OpenLayers/Format/XML/VersionedOGC.js b/lib/OpenLayers/Format/XML/VersionedOGC.js index 178840a459..17efee6b63 100644 --- a/lib/OpenLayers/Format/XML/VersionedOGC.js +++ b/lib/OpenLayers/Format/XML/VersionedOGC.js @@ -12,6 +12,17 @@ * Class: OpenLayers.Format.XML.VersionedOGC * Base class for versioned formats, i.e. a format which supports multiple * versions. + * + * To enable checking if parsing succeeded, you will need to define a property + * called errorProperty on the parser you want to check. The parser will then + * check the returned object to see if that property is present. If it is, it + * assumes the parsing was successful. If it is not present (or is null), it will + * pass the document through an OGCExceptionReport parser. + * + * If errorProperty is undefined for the parser, this error checking mechanism + * will be disabled. + * + * * * Inherits from: * - @@ -45,15 +56,6 @@ OpenLayers.Format.XML.VersionedOGC = OpenLayers.Class(OpenLayers.Format.XML, { */ allowFallback: false, - /** - * APIProperty: errorProperty - * {String} Which property of the returned object to check for in order to - * determine whether or not parsing has failed. In the case that the - * errorProperty is undefined on the returned object, the document will be - * run through an OGCExceptionReport parser. - */ - errorProperty: null, - /** * Property: name * {String} The name of this parser, this is the part of the CLASS_NAME From 673f0d9a99e185faffb582caefe1e58fafc2b5c3 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 15:35:00 +0100 Subject: [PATCH 32/50] Remove unused commented code --- lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index 017a6fec41..2c37f8cdb2 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -147,12 +147,6 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( "label": function(node, coverageOfferingBrief) { coverageOfferingBrief.label = this.getChildValue(node); }, - // "lonLatEnvelope": function(node, coverageOfferingBrief) { - // debugger - // var bbox = OpenLayers.Format.GML.v3.prototype.readers["gml"].pos.apply(this, [node, coverageOfferingBrief]); - // bbox.srs = node.getAttribute("srsName"); - // coverageOfferingBrief.lonLatEnvelope[bbox.srs] = bbox; - // }, "lonLatEnvelope": function(node, coverageOfferingBrief) { var nodeList = this.getElementsByTagNameNS(node, "http://www.opengis.net/gml", "pos"); From c9dbc3364933f5951fa5514904429c85ed39e85c Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 15:38:27 +0100 Subject: [PATCH 33/50] Remove all traces of Protocol/WCS --- lib/OpenLayers.js | 1 - lib/OpenLayers/Protocol/WCS.js | 86 ---------------------------------- 2 files changed, 87 deletions(-) delete mode 100644 lib/OpenLayers/Protocol/WCS.js diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index 7e2d6e4bda..1935ef8eb9 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -280,7 +280,6 @@ "OpenLayers/Filter/Function.js", "OpenLayers/Protocol.js", "OpenLayers/Protocol/HTTP.js", - "OpenLayers/Protocol/WCS.js", "OpenLayers/Protocol/WFS.js", "OpenLayers/Protocol/WFS/v1.js", "OpenLayers/Protocol/WFS/v1_0_0.js", diff --git a/lib/OpenLayers/Protocol/WCS.js b/lib/OpenLayers/Protocol/WCS.js deleted file mode 100644 index 9520e3fbc0..0000000000 --- a/lib/OpenLayers/Protocol/WCS.js +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for - * full list of contributors). Published under the 2-clause BSD license. - * See license.txt in the OpenLayers distribution or repository for the - * full text of the license. */ - -/** - * @requires OpenLayers/Protocol.js - */ - -/** - * Class: OpenLayers.Protocol.WCS - * Used to create a versioned WCS protocol. Default version is 1.0.0. - * - * Returns: - * {} A WCS protocol of the given version. - * - * Example: - * (code) - * var protocol = new OpenLayers.Protocol.WCS({ - * version: "1.1.0", - * url: "http://demo.opengeo.org/geoserver/wcs", - * featureType: "tasmania_roads", - * featureNS: "http://www.openplans.org/topp", - * geometryName: "the_geom" - * }); - * (end) - * - * See the protocols for specific WCS versions for more detail. - */ -OpenLayers.Protocol.WCS = function(options) { - options = OpenLayers.Util.applyDefaults( - options, OpenLayers.Protocol.WCS.DEFAULTS - ); - var cls = OpenLayers.Protocol.WCS["v"+options.version.replace(/\./g, "_")]; - if(!cls) { - throw "Unsupported WCS version: " + options.version; - } - return new cls(options); -}; - -/** - * Function: fromWMSLayer - * Convenience function to create a WCS protocol from a WMS layer. This makes - * the assumption that a WCS requests can be issued at the same URL as - * WMS requests and that a WCS featureType exists with the same name as the - * WMS layer. - * - * This function is designed to auto-configure , , - * and for WCS 1.1.0. Note that - * srsName matching with the WMS layer will not work with WCS 1.0.0. - * - * Parameters: - * layer - {} WMS layer that has a matching WCS - * FeatureType at the same server url with the same typename. - * options - {Object} Default properties to be set on the protocol. - * - * Returns: - * {} - */ -OpenLayers.Protocol.WCS.fromWMSLayer = function(layer, options) { - var typeName, featurePrefix; - var param = layer.params["LAYERS"]; - var parts = (OpenLayers.Util.isArray(param) ? param[0] : param).split(":"); - if(parts.length > 1) { - featurePrefix = parts[0]; - } - typeName = parts.pop(); - var protocolOptions = { - url: layer.url, - featureType: typeName, - featurePrefix: featurePrefix, - srsName: layer.projection && layer.projection.getCode() || - layer.map && layer.map.getProjectionObject().getCode(), - version: "1.1.0" - }; - return new OpenLayers.Protocol.WCS(OpenLayers.Util.applyDefaults( - options, protocolOptions - )); -}; - -/** - * Constant: OpenLayers.Protocol.WCS.DEFAULTS - */ -OpenLayers.Protocol.WCS.DEFAULTS = { - "version": "1.0.0" -}; \ No newline at end of file From 3f9461e91ccaf8bce5d6cd33b81ba254cf4331bf Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 15:39:55 +0100 Subject: [PATCH 34/50] Update terminology --- lib/OpenLayers/Format/WCSCapabilities/v1.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1.js b/lib/OpenLayers/Format/WCSCapabilities/v1.js index d0dc4326c2..b9655d41e9 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1.js @@ -29,13 +29,13 @@ OpenLayers.Format.WCSCapabilities.v1 = OpenLayers.Class( /** * APIMethod: read - * Read capabilities data from a string, and return a list of layers. + * Read capabilities data from a string, and return a list of coverages. * * Parameters: * data - {String} or {DOMElement} data to read/parse. * * Returns: - * {Array} List of named layers. + * {Array} List of named coverages. */ read: function(data) { if(typeof data == "string") { From c8e0ba554451faf92c7ffbf067a860fb3e6acb72 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 15:42:03 +0100 Subject: [PATCH 35/50] Reduce vertical whitespace --- lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index 2c37f8cdb2..f3555f6aae 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -26,7 +26,6 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( * this instance. */ - /** * Property: namespaces * {Object} Mapping of namespace aliases to namespace URIs. @@ -38,7 +37,6 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( ows: "http://www.opengis.net/ows" }, - /** * Property: errorProperty * {String} Which property of the returned object to check for in order to @@ -48,7 +46,6 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( */ errorProperty: "service", - /** * Property: readers * Contains public functions, grouped by namespace prefix, that will From 76aa10c52c4be99b40ab2777a0a95a06989c3deb Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 15:42:46 +0100 Subject: [PATCH 36/50] Add trailing LF --- lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index f3555f6aae..b1d682e369 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -166,4 +166,4 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( CLASS_NAME: "OpenLayers.Format.WCSCapabilities.v1_0_0" -}); \ No newline at end of file +}); From a215f362cc0951a9f958dbc19f36a8d356255a9c Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 15:46:35 +0100 Subject: [PATCH 37/50] Remove call to applyDefaults --- lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index b1d682e369..23513e376d 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -55,7 +55,7 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( * from the parent. */ readers: { - "wcs": OpenLayers.Util.applyDefaults({ + "wcs": { "WCS_Capabilities": function(node, obj) { this.readChildNodes(node, obj); }, @@ -161,7 +161,7 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( coverageOfferingBrief.lonLatEnvelope.max = max.points[0]; } }, - }, OpenLayers.Format.WCSCapabilities.v1.prototype.readers["wcs"]) + }, }, CLASS_NAME: "OpenLayers.Format.WCSCapabilities.v1_0_0" From d7200903107f7149810a0c9271f83cb3e13746cf Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 16:05:06 +0100 Subject: [PATCH 38/50] Reduce vertical whitespace --- lib/OpenLayers/Format/WCSCapabilities/v1.js | 1 - lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1.js b/lib/OpenLayers/Format/WCSCapabilities/v1.js index b9655d41e9..62d59dd1a2 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1.js @@ -50,7 +50,6 @@ OpenLayers.Format.WCSCapabilities.v1 = OpenLayers.Class( return capabilities; }, - CLASS_NAME: "OpenLayers.Format.WCSCapabilities.v1" }); \ No newline at end of file diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index be09e874c3..b578407d8f 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -18,7 +18,6 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( OpenLayers.Format.WCSCapabilities.v1, { - /** * Property: namespaces * {Object} Mapping of namespace aliases to namespace URIs. From ff4e6fc8d7cb098a33094e9a47db6df83b8d9929 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 16:26:24 +0100 Subject: [PATCH 39/50] git acting strangely --- lib/OpenLayers/Protocol/WCS.js | 86 ++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 lib/OpenLayers/Protocol/WCS.js diff --git a/lib/OpenLayers/Protocol/WCS.js b/lib/OpenLayers/Protocol/WCS.js new file mode 100644 index 0000000000..9520e3fbc0 --- /dev/null +++ b/lib/OpenLayers/Protocol/WCS.js @@ -0,0 +1,86 @@ +/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the 2-clause BSD license. + * See license.txt in the OpenLayers distribution or repository for the + * full text of the license. */ + +/** + * @requires OpenLayers/Protocol.js + */ + +/** + * Class: OpenLayers.Protocol.WCS + * Used to create a versioned WCS protocol. Default version is 1.0.0. + * + * Returns: + * {} A WCS protocol of the given version. + * + * Example: + * (code) + * var protocol = new OpenLayers.Protocol.WCS({ + * version: "1.1.0", + * url: "http://demo.opengeo.org/geoserver/wcs", + * featureType: "tasmania_roads", + * featureNS: "http://www.openplans.org/topp", + * geometryName: "the_geom" + * }); + * (end) + * + * See the protocols for specific WCS versions for more detail. + */ +OpenLayers.Protocol.WCS = function(options) { + options = OpenLayers.Util.applyDefaults( + options, OpenLayers.Protocol.WCS.DEFAULTS + ); + var cls = OpenLayers.Protocol.WCS["v"+options.version.replace(/\./g, "_")]; + if(!cls) { + throw "Unsupported WCS version: " + options.version; + } + return new cls(options); +}; + +/** + * Function: fromWMSLayer + * Convenience function to create a WCS protocol from a WMS layer. This makes + * the assumption that a WCS requests can be issued at the same URL as + * WMS requests and that a WCS featureType exists with the same name as the + * WMS layer. + * + * This function is designed to auto-configure , , + * and for WCS 1.1.0. Note that + * srsName matching with the WMS layer will not work with WCS 1.0.0. + * + * Parameters: + * layer - {} WMS layer that has a matching WCS + * FeatureType at the same server url with the same typename. + * options - {Object} Default properties to be set on the protocol. + * + * Returns: + * {} + */ +OpenLayers.Protocol.WCS.fromWMSLayer = function(layer, options) { + var typeName, featurePrefix; + var param = layer.params["LAYERS"]; + var parts = (OpenLayers.Util.isArray(param) ? param[0] : param).split(":"); + if(parts.length > 1) { + featurePrefix = parts[0]; + } + typeName = parts.pop(); + var protocolOptions = { + url: layer.url, + featureType: typeName, + featurePrefix: featurePrefix, + srsName: layer.projection && layer.projection.getCode() || + layer.map && layer.map.getProjectionObject().getCode(), + version: "1.1.0" + }; + return new OpenLayers.Protocol.WCS(OpenLayers.Util.applyDefaults( + options, protocolOptions + )); +}; + +/** + * Constant: OpenLayers.Protocol.WCS.DEFAULTS + */ +OpenLayers.Protocol.WCS.DEFAULTS = { + "version": "1.0.0" +}; \ No newline at end of file From d0af8726d3c256f3f76498340cfbb55e242e622b Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 16:26:55 +0100 Subject: [PATCH 40/50] Remove this file properly --- lib/OpenLayers/Protocol/WCS.js | 86 ---------------------------------- 1 file changed, 86 deletions(-) delete mode 100644 lib/OpenLayers/Protocol/WCS.js diff --git a/lib/OpenLayers/Protocol/WCS.js b/lib/OpenLayers/Protocol/WCS.js deleted file mode 100644 index 9520e3fbc0..0000000000 --- a/lib/OpenLayers/Protocol/WCS.js +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for - * full list of contributors). Published under the 2-clause BSD license. - * See license.txt in the OpenLayers distribution or repository for the - * full text of the license. */ - -/** - * @requires OpenLayers/Protocol.js - */ - -/** - * Class: OpenLayers.Protocol.WCS - * Used to create a versioned WCS protocol. Default version is 1.0.0. - * - * Returns: - * {} A WCS protocol of the given version. - * - * Example: - * (code) - * var protocol = new OpenLayers.Protocol.WCS({ - * version: "1.1.0", - * url: "http://demo.opengeo.org/geoserver/wcs", - * featureType: "tasmania_roads", - * featureNS: "http://www.openplans.org/topp", - * geometryName: "the_geom" - * }); - * (end) - * - * See the protocols for specific WCS versions for more detail. - */ -OpenLayers.Protocol.WCS = function(options) { - options = OpenLayers.Util.applyDefaults( - options, OpenLayers.Protocol.WCS.DEFAULTS - ); - var cls = OpenLayers.Protocol.WCS["v"+options.version.replace(/\./g, "_")]; - if(!cls) { - throw "Unsupported WCS version: " + options.version; - } - return new cls(options); -}; - -/** - * Function: fromWMSLayer - * Convenience function to create a WCS protocol from a WMS layer. This makes - * the assumption that a WCS requests can be issued at the same URL as - * WMS requests and that a WCS featureType exists with the same name as the - * WMS layer. - * - * This function is designed to auto-configure , , - * and for WCS 1.1.0. Note that - * srsName matching with the WMS layer will not work with WCS 1.0.0. - * - * Parameters: - * layer - {} WMS layer that has a matching WCS - * FeatureType at the same server url with the same typename. - * options - {Object} Default properties to be set on the protocol. - * - * Returns: - * {} - */ -OpenLayers.Protocol.WCS.fromWMSLayer = function(layer, options) { - var typeName, featurePrefix; - var param = layer.params["LAYERS"]; - var parts = (OpenLayers.Util.isArray(param) ? param[0] : param).split(":"); - if(parts.length > 1) { - featurePrefix = parts[0]; - } - typeName = parts.pop(); - var protocolOptions = { - url: layer.url, - featureType: typeName, - featurePrefix: featurePrefix, - srsName: layer.projection && layer.projection.getCode() || - layer.map && layer.map.getProjectionObject().getCode(), - version: "1.1.0" - }; - return new OpenLayers.Protocol.WCS(OpenLayers.Util.applyDefaults( - options, protocolOptions - )); -}; - -/** - * Constant: OpenLayers.Protocol.WCS.DEFAULTS - */ -OpenLayers.Protocol.WCS.DEFAULTS = { - "version": "1.0.0" -}; \ No newline at end of file From 951da38e80bcbdeb6fc3e0ece5d1f9b0afe77b48 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 16:48:32 +0100 Subject: [PATCH 41/50] Add @requires --- lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index 23513e376d..8f4379648f 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -5,6 +5,7 @@ /** * @requires OpenLayers/Format/WCSCapabilities/v1.js + * @requires OpenLayers/Format/GML/v3.js */ /** From 730415aa741148a1e16755903be34112b4b98cf4 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 16:49:53 +0100 Subject: [PATCH 42/50] Update @requires --- lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index b578407d8f..91d6fa2829 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -4,7 +4,7 @@ * full text of the license. */ /** - * @requires OpenLayers/Format/WCSCapabilities/v1.js + * @requires OpenLayers/Format/WCSCapabilities/v1_1_0.js * @requires OpenLayers/Format/OWSCommon/v1.js */ From ed6a32cea7d98923eb0b38333596cc85205ee2e7 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 16:52:17 +0100 Subject: [PATCH 43/50] Fix @requires --- lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index 91d6fa2829..d52b08783e 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -4,8 +4,8 @@ * full text of the license. */ /** - * @requires OpenLayers/Format/WCSCapabilities/v1_1_0.js - * @requires OpenLayers/Format/OWSCommon/v1.js + * @requires OpenLayers/Format/WCSCapabilities/v1.js + * @requires OpenLayers/Format/OWSCommon/v1_1_0.js */ /** From 91bf459ab28ce7233f01d7816e01bd9f72f07580 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 17:04:16 +0100 Subject: [PATCH 44/50] Tactical retreat from dot notation --- lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index d52b08783e..8673fc7ada 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -80,7 +80,7 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( coverageSummary.title = this.getChildValue(node); }, "Abstract": function(node, coverageSummary) { - coverageSummary.abstract = this.getChildValue(node); + coverageSummary["abstract"] = this.getChildValue(node); }, "SupportedCRS": function(node, coverageSummary) { var crs = this.getChildValue(node); From 0a93154f32786bb9fc7b9bc2d3618f80c1af49ed Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 17:05:54 +0100 Subject: [PATCH 45/50] Remove trailing commas --- lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js | 4 ++-- lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js index 8f4379648f..a04b7a968d 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js @@ -161,8 +161,8 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class( coverageOfferingBrief.lonLatEnvelope.min = min.points[0]; coverageOfferingBrief.lonLatEnvelope.max = max.points[0]; } - }, - }, + } + } }, CLASS_NAME: "OpenLayers.Format.WCSCapabilities.v1_0_0" diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index 8673fc7ada..4c8dd27e79 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -102,7 +102,7 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( }, }, OpenLayers.Format.WCSCapabilities.v1.prototype.readers["wcs"]), - "ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"], + "ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"] }, CLASS_NAME: "OpenLayers.Format.WCSCapabilities.v1_1_0" From 54c5656df5cf7b642d4c92c8dcb94090afc84e6b Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 17:08:57 +0100 Subject: [PATCH 46/50] Add final LF --- tests/Format/WFSCapabilities.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Format/WFSCapabilities.html b/tests/Format/WFSCapabilities.html index 4e6545e160..fc2ff2d0eb 100644 --- a/tests/Format/WFSCapabilities.html +++ b/tests/Format/WFSCapabilities.html @@ -40,4 +40,4 @@ - \ No newline at end of file + From 9c7f6e1de776c907e8a9c80c02c87e271d7e2ad9 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 17:10:02 +0100 Subject: [PATCH 47/50] Add final LF --- lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index 4c8dd27e79..3038228025 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -107,4 +107,4 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( CLASS_NAME: "OpenLayers.Format.WCSCapabilities.v1_1_0" -}); \ No newline at end of file +}); From f9bb64505b709479153ba6888a9e2a03d886b232 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 17:12:51 +0100 Subject: [PATCH 48/50] Add final LF --- tests/Format/WCSCapabilities.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Format/WCSCapabilities.html b/tests/Format/WCSCapabilities.html index aa3d3267ae..b3e90b6bf3 100644 --- a/tests/Format/WCSCapabilities.html +++ b/tests/Format/WCSCapabilities.html @@ -40,4 +40,4 @@ - \ No newline at end of file + From fe799ddfff671654373f32da5eeab52fcb789302 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 17:15:40 +0100 Subject: [PATCH 49/50] Add notes --- notes/2.13.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/notes/2.13.md b/notes/2.13.md index 8fdaf0a1d0..9de5f7626e 100644 --- a/notes/2.13.md +++ b/notes/2.13.md @@ -68,3 +68,7 @@ Corresponding issue/pull requests: # Different return type for OpenLayers.Format.WMSDescribeLayer The return type of WMSDescribeLayer format's `read` method was different from the one of the VersionedOGC format superclass. So it was changed from an array to an object with a layerDescriptions property that holds the array. For backwards compatibility, the object still has a length property and 0, ..., n properties with the previous array values. + +# Moved errorProperty from the base class to the parser + +This was necessary for WCS support because there are no properties in common between versions 1.0.0 and 1.1.0 that were appropriate for checking. The only existing code that this affected was WFS parsing. From adba74b7358cb1b6337a4593e6dfbcc0113a3944 Mon Sep 17 00:00:00 2001 From: Christopher Eykamp Date: Wed, 2 Jan 2013 17:29:50 +0100 Subject: [PATCH 50/50] Remove blank line and trailing comma --- lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js index 3038228025..f1da4cff56 100644 --- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js +++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js @@ -99,8 +99,7 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class( } coverageSummary.supportedFormat.push(format); } - }, - + } }, OpenLayers.Format.WCSCapabilities.v1.prototype.readers["wcs"]), "ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"] },