[OpenLayers-Users] Control.GetFeature

stash steffen.schwarz85 at googlemail.com
Mon Nov 30 03:59:33 EST 2009




Ivan Grcic-2 wrote:
> 
> OpenLayers.Protocol.WFS.fromWMSLayer is just convinient method for
> creating OpenLayers.Protocol.WFS from allready defined WMS layer. So
> you can just define protocol as:
> 
> protocol: OpenLayers.Protocol.WFS({
>             readFormat: new OpenLayers.Format.GeoJSON(),
>             formatOptions: {
>                 outputFormat: "JSON"
>             },
>             url: "http://localhost:8080/geoserver/wfs"
>             featureType: "ftName",
>             featurePrefix: 'prefix',
>             featureNS: "http://ns",
>             geometryName: 'geometry',
>             maxFeatures: 100
> })
> 
> 

Hello,
thanks for your post. I tried this but it doesn't work. Here is my code.


var control = new OpenLayers.Control.GetFeature({
protocol: OpenLayers.Protocol.WFS({
            readFormat: new OpenLayers.Format.GeoJSON(),
            formatOptions: {
                outputFormat: "JSON"
            },
            url: "http://localhost:8080/geoserver/wfs",
            featureType: "MY_LAYER",
            featurePrefix: 'topp',
            featureNS: "http://www.openplans.org/topp",
            geometryName: 'GEOM',
            maxFeatures: 100,
           defaultFilter: my_filter
   })
   });
   
control.events.register("featureselected", this, function(e) {
    select.addFeatures([e.feature]);
});

map.addControl(control);
control.activate();

When I launch my app I get an error that feature.lenght is null or doesn't
exist?

Do I have to implement a map.events.register as I did it with my
getfeatureinfo or is there something else wrong.

Thanks for your help

Regards
stash
-- 
View this message in context: http://n2.nabble.com/Control-GetFeature-tp4075933p4086400.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list