[OpenLayers-Users] Consuming WFS Complex Features

amacleod webmaster at cecc.com.au
Thu Nov 3 21:08:28 EDT 2011


Hi All
      Just wondering if anyone has any experience in getting Openlayers to
consume complex features from a WFS service. 
	  From what I can tell from our struggles to get this working, the
Openlayers GML parser is only designed for simple features. It has problems
when there are mixed namespaces in the service and is unable to determine 
	  the correct geometry element to use. Before we go and look at extending
the GML parser, I thought I would see if there was any other work going on
in this area. We are a bit new to this space so please forgive my 
	  ignorance if we are missing something glaringly obvious or doing
something incorectly. I've provided as much detail as I can below. Any
assistance would be apreciated.  
	  
	  Sample WFS data (notice the mixture of gml: gsml: gwml: and sa:
namespaces)
	  
	  <wfs:FeatureCollection numberOfFeatures="10"
timeStamp="2011-11-04T10:44:01.663+11:00"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd
http://www.nrcan.gc.ca/xml/gwml/1
http://ngwd-bdnes.cits.nrcan.gc.ca/service/gwml/schemas/gwml.xsd"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gwml="http://www.nrcan.gc.ca/xml/gwml/1"
xmlns:sa="http://www.opengis.net/sampling/1.0"
xmlns:swe="http://www.opengis.net/swe/1.0.1"
xmlns:om="http://www.opengis.net/om/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gsml="urn:cgi:xmlns:CGI:GeoSciML:2.0"
xmlns:ows="http://www.opengis.net/ows"
xmlns:gml="http://www.opengis.net/gml" xmlns:test="http://test.org"
xmlns:xlink="http://www.w3.org/1999/xlink">
		<gml:featureMembers>
		<gwml:WaterWell gml:id="ffsr.waterwell.-877519">
		<gml:name
codeSpace="http://www.ietf.org/rfc/rfc2616">http://groundwater.data.vic.gov.au/waterwell/ffsr/ffsr.waterwell.-877519</gml:name>
		<sa:sampledFeature
xlink:href="http://www.opengis.net/def/nil/OGC/0/unknown"
xlink:role="http://www.geosciml.org/geosciml/2.0/doc/GeoSciML/GeologicUnit/GeologicUnit.html"
xlink:title="unknown"/>
		<sa:position>
		<gml:Point srsDimension="2" srsName="urn:x-ogc:def:crs:EPSG:4283">
		<gml:pos>-37.574709832296264 142.5879533591661</gml:pos>
		</gml:Point>
		</sa:position>
		<gwml:referenceElevation
uom="http://www.opengis.net/def/uom/OGC/1.0/metre"/>
		<gwml:wellDepth>
		<gsml:CGI_NumericValue>
		<gsml:principalValue
uom="http://www.opengis.net/def/uom/OGC/1.0/metre">9999.0</gsml:principalValue>
		</gsml:CGI_NumericValue>
		</gwml:wellDepth>
		<gwml:wellStatus>
		<gsml:CGI_TermValue>
		<gsml:value codeSpace="http://www.dpi.vic.gov.au/agriculture">Unqualified                  
</gsml:value>
		</gsml:CGI_TermValue>
		</gwml:wellStatus>
		<gwml:wellType>
		<gsml:CGI_TermValue>
		<gsml:value
codeSpace="http://www.dpi.vic.gov.au/agriculture">drilled</gsml:value>
		</gsml:CGI_TermValue>
		</gwml:wellType>
		...
		</gwml:WaterWell>
	</wfs:FeatureCollection>
	
	versi_url =  "http://siss.versi.edu.au/geoserver/wfs";
	
	versi_wfs_dpi = new OpenLayers.Layer.Vector("WFS", {
		strategies: [new OpenLayers.Strategy.BBOX()],
		projection: new OpenLayers.Projection('EPSG:4326'),
		protocol: new OpenLayers.Protocol.WFS({
			url: versi_url,
			featureType: "WaterWell",
			featureNS: "http://www.nrcan.gc.ca/xml/gwml/1",
			featurePrefix: "gwml",
			version: "1.1.0",
			srsName: "EPSG:900913",
			geometryName: "sa:position",
			maxFeatures: 100,
			formatOptions: {
				externalProjection: new OpenLayers.Projection('EPSG:900913'),
				internalProjection: new OpenLayers.Projection('EPSG:4326')
			}
			//schema:
"http://siss.versi.edu.au/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=gwml:Waterwell"
		
		})
	});
	
	In Firebug we can see that features are returned but the bounds and
geometry of each feature are null. 
	
	By manually changing the GML to gwml:position (which is not valid) we have
confirmed that we can get points to appear on the map. 
	
	
http://osgeo-org.1803224.n2.nabble.com/file/n6961364/4-11-2011_12-06-15_PM.jpg 

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Consuming-WFS-Complex-Features-tp6961364p6961364.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list