[OpenLayers-Users] How to find Feature by Feature ID

B. Heath Robinson heath at midnighthour.org
Tue Mar 1 10:48:24 EST 2011


The vector layer has a features array you can iterate over.  I am doing this to delete a feature:

               for(fid in savedFeatureLayers[listId].features) {
                   feature = savedFeatureLayers[listId].features[fid];
                   if(feature.data.id == sfId){
                       savedFeatureLayers[listId].destroyFeatures([feature]);
                       break;
                   }
               }

On Mar 1, 2011, at 9:38 AM, Diego Guidi wrote:

>> is there any method to find a specific feature by featureID. If yes, can
>> somebody help me by sending some code sample. if no such method available,
>> then how we can do this ?
> looks that vector layers have a method that can be useful to yoy:
> http://dev.openlayers.org/releases/OpenLayers-2.6/doc/apidocs/files/OpenLayers/Layer/Vector-js.html
> see getFeatureById
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list