Im using Openlayers, and importing polygon data to the map with KML files.

How could i select the feature which has the attribute name="TEST" ?

KML def:

<Polygon><outerBoundaryIs><LinearRing><coordinates>//Some coordinates\\</coordinates></LinearRing></outerBoundaryIs></Polygon>

Iknow that you can loop trough them to check it. But i was hoping for something more efficient.

2 Answers 2


OpenLayers doesn't provide convenient method for getting features by custom attribute. You can see my implementation of getFeaturesBy method, example.


I found another solution to my problem using the preFeatureInsert method. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.