[OpenLayers-Users] Identify feature by attribute

Greg Allensworth gregor at greeninfo.org
Tue Jan 8 14:09:38 PST 2013


On 1/8/2013 1:41 PM, Jerome A. Wendell wrote:
> I am new to OpenLayers and web mapping.  I have searched the examples
> and help, and did not find any information on how to select a vector on
> a vector layer by attribute.

Assuming you have your Control.SelectFeature already defined and working 
with a click, you should be able to use its "select" method to manually 
feed it a feature:


/// your Control
clicker = new OpenLayers.Control.SelectFeature(blah blah);

// some arbitrary chosen Feature from the vector layer
feature = VECTORS.features[7];

// have the Select tool select this feature
clicker.select(feature);


-- 
Greg Allensworth, Web GIS Developer
BS  A+  Network+  Security+  Linux+  Server+
GreenInfo Network - Information and Mapping in the Public Interest
564 Market Street, Suite 510  San Francisco CA 94104
PH: 415-979-0343 x302  FX: 415-979-0371    email: gregor at greeninfo.org
Web: www.GreenInfo.org     www.MapsPortal.org

Subscribe to MapLines, our e-newsletter, at www.GreenInfo.org


More information about the Users mailing list