[OpenLayers-Users] WFS and OL

Gis Newbye gisnewbye at gmail.com
Mon Oct 14 11:10:03 PDT 2013


I've tested my WFS with
http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP

and all is fine i can see my data. And i see the states one time.

when i try to add it in Open Layers with:

 <script type="text/javascript">
        var map, layer, select, hover, control;

        function init(){
            OpenLayers.ProxyHost= "proxy.cgi?url=";
            map = new OpenLayers.Map('map', {
                controls: [
                    new OpenLayers.Control.PanZoom(),
                    new OpenLayers.Control.Permalink(),
                    new OpenLayers.Control.Navigation()
                ]
            });
            layer = new OpenLayers.Layer.WMS(
                "States WMS/WFS",
                "
http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP
",
                {layers: 'Municipality:MN_NAME', format: 'image/gif'}
            );
            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);
        }
    </script>

i see the states many time and not only one time! And i cannot "Query"
datas Why?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20131014/a5d1f38e/attachment.html>


More information about the Users mailing list