[OpenLayers-Users] problem with WFS GetFeature

pablo lopez plablo09 at gmail.com
Tue Nov 24 19:30:15 EST 2009


Hi list
I've seen this topic discussed on this list but I'm still a little lost.
I want to run the wfs get feature example with my own data served trough
mapserver.
I'm able to make the request and mapserver returns what seems to be a valid
gml, the only problem is that it is not displaying in OL. Here's the
relevant code:

 map = new OpenLayers.Map('map', {
                controls: [
                    new OpenLayers.Control.PanZoom(),
                    new OpenLayers.Control.Permalink(),
                    new OpenLayers.Control.Navigation()
                ]
            });
        layer = new OpenLayers.Layer.WMS(
        "Regiones ANUIES",
        "
http://192.168.5.241/cgi-bin/mapserv?map=/var/www/aplicaciones/sined/regsanu.map
",
        {layers: 'regs_anu'}
          );
            select = new OpenLayers.Layer.Vector("Selection", {styleMap:
                new
OpenLayers.Style(OpenLayers.Feature.Vector.style["select"])
            });
            hover = new OpenLayers.Layer.Vector("Hover");
            map.addLayers([layer, hover, select]);

            control = new OpenLayers.Control.GetFeature({
                protocol: OpenLayers.Protocol.WFS.fromWMSLayer(layer),
                box: true,
                hover: true,
                multipleKey: "shiftKey",
                toggleKey: "ctrlKey"
            });
            control.events.register("featureselected", this, function(e) {
                select.addFeatures([e.feature]);
            });
            control.events.register("featureunselected", this, function(e) {
                select.removeFeatures([e.feature]);
            });
            control.events.register("hoverfeature", this, function(e) {
                hover.addFeatures([e.feature]);
            });
            control.events.register("outfeature", this, function(e) {
                hover.removeFeatures([e.feature]);
            });
            map.addControl(control);
            control.activate();

            map.setCenter(new
OpenLayers.Bounds(-140.444336,25.115234,-44.438477,50.580078).getCenterLonLat(),
3);
        }

I think the problem could be with the gml version since mapserver is
returning gml v3.
Any thoughts.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091124/a539b9b7/attachment.html


More information about the Users mailing list