[OpenLayers-Users] Destroy/Delete a vector feature

Yves Moisan yves.moisan at boreal-is.com
Tue Dec 16 13:09:12 EST 2008


> My first thought is that after the data is loaded, if I could get the
> feature by ID or attribute and then destroy it, that would be great.

If you get to doing something like that, please share your code :-).
I'm trying to do something similar, that is set the state property of
the features in my GeoJSON response along the lines of :

pts_gps = new OpenLayers.Layer.Vector("GeoJSON", {
				   // styleMap: styleMap,
                    strategies: [new OpenLayers.Strategy.BBOX()],
                    protocol: new OpenLayers.Protocol.HTTP({
                        url: "http://myserver/PGTEST4326/all.json",
                        format: new OpenLayers.Format.GeoJSON()
                    }),
					eventListeners: {
                    loadend: function(??) {
					for (var i = 0, var len = pts_gps.features.length; i < len; i++) {
                pts_gps.features[i].state = OpenLayers.State.UNKNOWN;
                }} }
               
                });

and it doesn't work ...

Cheers,

Yves




More information about the Users mailing list