[OpenLayers-Users] Vector Layer, WFS Protocol and BBOX strategy problem

Pedro Baracho pedropbaracho at gmail.com
Mon Nov 9 14:15:43 EST 2009


Hey guys,

I spent the last two days trying to figure out how to solve this problem and
I couldn't. I have Spherical Mercator tutorial on reprojecting vector data
and I still can't figure out what I am doing wrong.

I am trying to overlay on Google Layer some vector data using WFS Protocol.

My problem is that whatever I do, OpenLayers request data from the server
using BBOX Strategy with projection EPSG:900913 but my data is on projection
EPSG:29193 and that gives me 2 problems:
1- The server gives a null response;
or
2- The server gives back the xml with the data, but the projection is on
29193 and OpenLayers thinks it is on 900913, so it displays in the wrong
place.

Here is the code for the map options:
var options = {
                maxExtent: new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
                numZoomLevels:18,
                maxResolution:156543.0339,
                units:'m',
                projection: "EPSG:900913",
                displayProjection: new OpenLayers.Projection("EPSG:4326"),
                controls: [ new OpenLayers.Control.PanZoom(), new
OpenLayers.Control.MouseDefaults(), new OpenLayers.Control.LayerSwitcher()
]
            };

And here is the code for the layer options:
var layer = new OpenLayers.Layer.Vector("WFS", {
                    strategies: [new OpenLayers.Strategy.BBOX(),
saveStrategy],
                    protocol: new OpenLayers.Protocol.WFS({
                        url:  "http://localhost:8080/geoserver/wfs",
                        featureType: "Regional",
                        featureNS: "http://prodabel1062.pbh:8080/avis",
                        geometryName: "GEOLOC",
                        srsName: "EPSG:29193"
                    }),
                    projection: new OpenLayers.Projection("EPSG:29193")
            });

As it is, I get null response from the server. And if I change the layer
projection to "EPSG:900913", I get the response, but no drawing (as it will
be in the wrong projection).

I have seen a thread in this list from Jachym Cepicky where he defined a
handler for preFeatureInsert event and reprojected his vector data
"manually". As I understand (from
http://docs.openlayers.org/library/spherical_mercator.html#reprojecting-vector-data)
this shouldn't be necessary, but right now I feel that is my only option
left.

Would you guys mind sheding some light over my problem?

Thanks,
Pedro.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091109/197c7023/attachment.html


More information about the Users mailing list