implement readers for URL endpoints in WFS 1.1
This commit is contained in:
1 parent
85b9d5f7f9
commit
3a23f15041
3 files changed
+54
-2
No files matched your search
@@ -59,7 +59,7 @@ OpenLayers.Format.WFSCapabilities.v1 = OpenLayers.Class(
|
||||
for(var i=0; i<children.length; ++i) {
|
||||
childNode = children[i];
|
||||
if(childNode.nodeType == 1) {
|
||||
processor = this["read_cap_" + childNode.nodeName];
|
||||
processor = this["read_cap_" + childNode.nodeName.replace(":", "_")];
|
||||
if(processor) {
|
||||
processor.apply(this, [obj, childNode]);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,56 @@ OpenLayers.Format.WFSCapabilities.v1_1_0 = OpenLayers.Class(
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_ows_OperationsMetadata
|
||||
*/
|
||||
read_cap_ows_OperationsMetadata: function(capabilities, node) {
|
||||
var capability = {
|
||||
request: {}
|
||||
};
|
||||
this.runChildNodes(capability.request, node);
|
||||
capabilities.capability = capability;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_ows_Operation
|
||||
*/
|
||||
read_cap_ows_Operation: function(request, node) {
|
||||
var operation = {
|
||||
href: {}
|
||||
};
|
||||
this.runChildNodes(operation.href, node);
|
||||
request[node.getAttribute("name").toLowerCase()] = operation;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_ows_DCP
|
||||
*/
|
||||
read_cap_ows_DCP: function(href, node) {
|
||||
this.runChildNodes(href, node);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_ows_HTTP
|
||||
*/
|
||||
read_cap_ows_HTTP: function(href, node) {
|
||||
this.runChildNodes(href, node);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_ows_Get
|
||||
*/
|
||||
read_cap_ows_Get: function(href, node) {
|
||||
href["get"] = node.getAttribute("xlink:href");
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read_cap_ows_Post
|
||||
*/
|
||||
read_cap_ows_Post: function(href, node) {
|
||||
href["post"] = node.getAttribute("xlink:href");
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_1_0"
|
||||
|
||||
});
|
||||
@@ -21,13 +21,15 @@
|
||||
}
|
||||
|
||||
function test_read(t) {
|
||||
t.plan(33);
|
||||
t.plan(35);
|
||||
|
||||
var parser = new OpenLayers.Format.WFSCapabilities();
|
||||
|
||||
// GeoServer, v1.1.0
|
||||
var text = '<?xml version="1.0" encoding="UTF-8"?><wfs:WFS_Capabilities version="1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wfs" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ows="http://www.opengis.net/ows" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wfs http://localhost:80/geoserver/schemas/wfs/1.1.0/wfs.xsd" xmlns:it.geosolutions="http://www.geo-solutions.it" xmlns:cite="http://www.opengeospatial.net/cite" xmlns:tiger="http://www.census.gov" xmlns:sde="http://geoserver.sf.net" xmlns:topp="http://www.openplans.org/topp" xmlns:sf="http://www.openplans.org/spearfish" xmlns:nurc="http://www.nurc.nato.int" updateSequence="57"><ows:ServiceIdentification><ows:Title>GeoServer Web Feature Service</ows:Title><ows:Abstract>This is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction.</ows:Abstract><ows:Keywords><ows:Keyword>WFS</ows:Keyword><ows:Keyword>WMS</ows:Keyword><ows:Keyword>GEOSERVER</ows:Keyword></ows:Keywords><ows:ServiceType>WFS</ows:ServiceType><ows:ServiceTypeVersion>1.1.0</ows:ServiceTypeVersion><ows:Fees>NONE</ows:Fees><ows:AccessConstraints>NONE</ows:AccessConstraints></ows:ServiceIdentification><ows:ServiceProvider><ows:ProviderName>The ancient geographes INC</ows:ProviderName><ows:ServiceContact><ows:IndividualName>Claudius Ptolomaeus</ows:IndividualName><ows:PositionName>Chief geographer</ows:PositionName><ows:ContactInfo><ows:Phone><ows:Voice/><ows:Facsimile/></ows:Phone><ows:Address><ows:City>Alexandria</ows:City><ows:AdministrativeArea/><ows:PostalCode/><ows:Country>Egypt</ows:Country></ows:Address></ows:ContactInfo></ows:ServiceContact></ows:ServiceProvider><ows:OperationsMetadata><ows:Operation name="GetCapabilities"><ows:DCP><ows:HTTP><ows:Get xlink:href="http://localhost:80/geoserver/wfs?"/><ows:Post xlink:href="http://localhost:80/geoserver/wfs?"/></ows:HTTP></ows:DCP><ows:Parameter name="AcceptVersions"><ows:Value>1.0.0</ows:Value><ows:Value>1.1.0</ows:Value></ows:Parameter><ows:Parameter name="AcceptFormats"><ows:Value>text/xml</ows:Value></ows:Parameter></ows:Operation><ows:Operation name="DescribeFeatureType"><ows:DCP><ows:HTTP><ows:Get xlink:href="http://localhost:80/geoserver/wfs?"/><ows:Post xlink:href="http://localhost:80/geoserver/wfs?"/></ows:HTTP></ows:DCP><ows:Parameter name="outputFormat"><ows:Value>text/xml; subtype=gml/3.1.1</ows:Value></ows:Parameter></ows:Operation><ows:Operation name="GetFeature"><ows:DCP><ows:HTTP><ows:Get xlink:href="http://localhost:80/geoserver/wfs?"/><ows:Post xlink:href="http://localhost:80/geoserver/wfs?"/></ows:HTTP></ows:DCP><ows:Parameter name="resultType"><ows:Value>results</ows:Value><ows:Value>hits</ows:Value></ows:Parameter><ows:Parameter name="outputFormat"><ows:Value>text/xml; subtype=gml/3.1.1</ows:Value><ows:Value>GML2</ows:Value><ows:Value>GML2-GZIP</ows:Value><ows:Value>SHAPE-ZIP</ows:Value><ows:Value>csv</ows:Value><ows:Value>gml3</ows:Value><ows:Value>json</ows:Value><ows:Value>text/xml; subtype=gml/2.1.2</ows:Value></ows:Parameter><ows:Constraint name="LocalTraverseXLinkScope"><ows:Value>2</ows:Value></ows:Constraint></ows:Operation><ows:Operation name="GetGmlObject"><ows:DCP><ows:HTTP><ows:Get xlink:href="http://localhost:80/geoserver/wfs?"/><ows:Post xlink:href="http://localhost:80/geoserver/wfs?"/></ows:HTTP></ows:DCP></ows:Operation><ows:Operation name="LockFeature"><ows:DCP><ows:HTTP><ows:Get xlink:href="http://localhost:80/geoserver/wfs?"/><ows:Post xlink:href="http://localhost:80/geoserver/wfs?"/></ows:HTTP></ows:DCP><ows:Parameter name="releaseAction"><ows:Value>ALL</ows:Value><ows:Value>SOME</ows:Value></ows:Parameter></ows:Operation><ows:Operation name="GetFeatureWithLock"><ows:DCP><ows:HTTP><ows:Get xlink:href="http://localhost:80/geoserver/wfs?"/><ows:Post xlink:href="http://localhost:80/geoserver/wfs?"/></ows:HTTP></ows:DCP><ows:Parameter name="resultType"><ows:Value>results</ows:Value><ows:Value>hits</ows:Value></ows:Parameter><ows:Parameter name="outputFormat"><ows:Value>text/xml; subtype=gml/3.1.1</ows:Value><ows:Value>GML2</ows:Value><ows:Value>GML2-GZIP</ows:Value><ows:Value>SHAPE-ZIP</ows:Value><ows:Value>csv</ows:Value><ows:Value>gml3</ows:Value><ows:Value>json</ows:Value><ows:Value>text/xml; subtype=gml/2.1.2</ows:Value></ows:Parameter></ows:Operation><ows:Operation name="Transaction"><ows:DCP><ows:HTTP><ows:Get xlink:href="http://localhost:80/geoserver/wfs?"/><ows:Post xlink:href="http://localhost:80/geoserver/wfs?"/></ows:HTTP></ows:DCP><ows:Parameter name="inputFormat"><ows:Value>text/xml; subtype=gml/3.1.1</ows:Value></ows:Parameter><ows:Parameter name="idgen"><ows:Value>GenerateNew</ows:Value><ows:Value>UseExisting</ows:Value><ows:Value>ReplaceDuplicate</ows:Value></ows:Parameter><ows:Parameter name="releaseAction"><ows:Value>ALL</ows:Value><ows:Value>SOME</ows:Value></ows:ParameLine truncated
|
||||
var res = parser.read(text);
|
||||
t.eq(res.capability.request.getfeature.href.get, "http://localhost:80/geoserver/wfs?", "GetFeature GET endpoint correctly parsed");
|
||||
t.eq(res.capability.request.getfeature.href.post, "http://localhost:80/geoserver/wfs?", "GetFeature POST endpoint correctly parsed");
|
||||
var 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");
|
||||
|
||||
Reference in new issue
Block a user