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");