[OpenLayers-Users] Possible bug with Protocol.WFS

Brian Stempin brian.stempin at gmail.com
Mon Feb 8 18:58:09 EST 2010


Hi all,

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.

So, at one point, I packaged some of my WFS output into an XML file and
tschaub wrote the following example for me (which worked,
http://astro.temple.edu/~tub09307/tschaub.html):

> <html>
>     <head>
>         <title>Brian's Data</title>
>         <script src="http://www.openlayers.org/api/OpenLayers.js
> "></script>
>     </head>
>     <body>
>         <div id="map" class="smallmap"></div>
>         <script>
>
>             var map = new OpenLayers.Map({
>                 div: "map",
>                 projection: new OpenLayers.Projection("EPSG:900913"),
>                 units: "m",
>                 maxResolution: 500, // meters per pixel
>                 maxExtent: new OpenLayers.Bounds(
>                     -10462261, 5577086, -10305718, 5655358 // bounds of
> data
>                 )
>             });
>
>         var traffic = new OpenLayers.Layer.Vector("Traffic", {
>                 isBaseLayer: true,
>                 strategies: [new OpenLayers.Strategy.BBOX()],
>                 styleMap: style,
>                 protocol:new OpenLayers.Protocol.WFS({
>                     version: "1.1.0",
>                     url: "OpenLayers-2.8/examples/gml/test.xml",
>                     featureType: "v_stats_20090101_000000",
>                     featureNS: "http://192.168.0.20/geoserver/wms",
>                     geometryName: "the_geom"
>                 })
>             });
>
>             map.addLayer(traffic);
>             map.zoomToMaxExtent();
>
>         </script>
>         <form>
>     </body>
> </html>
>

I then modified it to this, which did not work:

> <html>
>     <head>
>         <title>Brian's Data</title>
>         <!-- added by bstempi -->
>         <script src="http://www.openlayers.org/api/OpenLayers.js
> "></script>
>     </head>
>     <body>
>         <div id="map" class="smallmap"></div>
>         <script>
>
>             var map = new OpenLayers.Map({
>                 div: "map",
>                 projection: new OpenLayers.Projection("EPSG:900913"),
>                 units: "m",
>                 maxResolution: 500, // meters per pixel
>                 maxExtent: new OpenLayers.Bounds(
>                     -10462261, 5577086, -10305718, 5655358 // bounds of
> data
>                 )
>             });
>
>             var traffic = new OpenLayers.Layer.Vector("Traffic", {
>                 isBaseLayer: true,
>                 strategies: [new OpenLayers.Strategy.BBOX()],
>                 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"
>                 })
>             });
>
>             map.addLayer(traffic);
>             map.zoomToMaxExtent();
>
>         </script>
>     </body>
> </html>
>

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?

Thanks,
Brian Stempin
brian.stempin at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100208/af452a33/attachment.html


More information about the Users mailing list