[OpenLayers-Users] Possible bug with Protocol.WFS

Tim Schaub tschaub at opengeo.org
Tue Feb 9 11:47:38 EST 2010


Andreas Hocevar wrote:
> Hi,
> 
> Brian Stempin wrote:
>> I've been working with a few people on #openlayers to help me out with 
>> a WFS issue.  I'm posting this to the list because I may have found a 
>> bug in the process.
>>
>>
>>                     protocol:new OpenLayers.Protocol.WFS({
>>                         version: "1.1.0",
>>                         //url: "test.xml",
>>                         // modified by bstempi
>>                         url: "/geoserver/wms",
>>                         featureType: "v_stats_20090101_000000",
>>                         featureNS: "http://192.168.0.20/geoserver/wms",
>>                         geometryName: "the_geom"
>>                     })
>>                 });
>>
>>
>> I found that the above code will work if you add srsName: 
>> "EPSG:900913" to the WFS options.
>>
>> Is this a feature/bug/magic, or me being silly?
> 
> You mean it works if you add that to the protocol options, right? That's 
> the way it is done. The BBOX strategy will use map coordinates 
> (EPSG:900913), and the protocol would think they are in the default SRS 
> for the feature type if you don't tell it what the SRS is.
> 

Right.  Sorry I stopped short of making it work for your WFS (as an 
aside, though GeoServer is lenient with your /geoserver/wms url above, 
it might be less misleading to use /geoserver/ows or /geoserver/wfs - no 
real difference if you are sending the SERVICE parameter, but it is less 
confusing to the reader).

One way you could have determined what was wrong was to examine the 
outgoing GetFeature request.  In Firebug, you should see the POST 
request being issued.  Looking at the body of the request, I imagine 
you'll see an element representing the bounding box with an srsName 
attribute of "EPSG:4326".  It is a shortcoming of the protocol that it 
doesn't try to guess the srsName from the layer projection.  I'll ticket 
this.

In the meantime, you should set srsName explicitly in the protocol 
options if it differs from "EPSG:4326".  The reason it is settable 
(instead of always derived from the layer projection) is that some 
servers may require an srsName that cannot be derived from the layer 
projection (as things currently stand).

Thanks for the patience.

Tim

> Regards,
> Andreas.
> 


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Users mailing list