From: Jon B. <jon...@go...> - 2011-06-08 10:26:55
|
Hi, I'm trying to use GWT-OpenLayers to carry out some simple WFS requests. However, I'm having some trouble with OpenLayers not displaying my data. I'm using GeoServer as my WFS, which names its layers like "sf:roads", where "sf" is the namespace. This first example, where I specify the namespace URL, works fine: ### JAVA CODE ### WFSProtocolOptions wfsProtocolOptions = new WFSProtocolOptions(); wfsProtocolOptions.setUrl(" http://li199-25.members.linode.com:8080/geoserver/wfs"); wfsProtocolOptions.setFeatureType("roads"); wfsProtocolOptions.setFeatureNameSpace("http://www.openplans.org/spearfish "); wfsProtocolOptions.setSrsName("EPSG:4326"); wfsProtocolOptions.setVersion("1.1.0"); This results in OpenLayers making the following XML request, which leads to a valid response which is displayed correctly: ### XML GetFeature REQUEST ### <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version ="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"> <wfs:Query typeName="feature:roads" srsName="EPSG:4326" xmlns:feature=" http://www.openplans.org/spearfish"></wfs:Query> </wfs:GetFeature> However, this next example does not work. Here, I'm only specifying the full layer title "sf:road" and not specifying the namespace. ### JAVA CODE ### WFSProtocolOptions wfsProtocolOptions = new WFSProtocolOptions(); wfsProtocolOptions.setUrl(" http://li199-25.members.linode.com:8080/geoserver/wfs"); wfsProtocolOptions.setFeatureType("sf:roads"); wfsProtocolOptions.setSrsName("EPSG:4326"); wfsProtocolOptions.setVersion("1.1.0"); This results in the following XML request being sent. GeoServer handles this request fine and returns a valid FeatureCollection (as far as I can tell, it's exactly the same as the previous example). However, for some reason OpenLayers just won't display it! ### XML GetFeature REQUEST ### <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"><wfs:Query typeName="sf:streams" srsName="EPSG:4326"/></wfs:GetFeature> Does anyone have any idea why OpenLayers won't display the results of this kind of request? Thanks, Jon |