Hi,
you can use the OpenLayers.Control.SelectFeature. There is a function select
with a feature to select as argument.
ctrlSelectFeatures = new OpenLayers.Control.SelectFeature(...);
function radioSelectFeature(idx)
{
var vlyr = map.layers[1];
try{
ctrlSelectFeatures.unselect(vlyr.selectedFeatures[0]);
}catch(err){document.getElementById("featDesc").innerHTML='error'};
ctrlSelectFeatures.select(vlyr.features[idx]);
}
from
http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/select-feature-with
-function.html
Arnd
_____
Von: [email protected] [mailto:[email protected]] Im
Auftrag von Alex Brandsen
Gesendet: Freitag, 23. Juli 2010 18:18
An: emmexx
Cc: [email protected]
Betreff: Re: [OpenLayers-Users] Manually 'select' feature
Thanks for replying!
getFeatureById() and OpenLayers.Layer.Vector.selectedFeatures both return
feature(s), I don't see how I can use these functions to select features?
Alex.
On Thu, Jul 22, 2010 at 2:56 PM, emmexx <[email protected]> wrote:
Il 22/07/2010 15:24, Alex Brandsen scrisse:
> Hi all,
>
> I was wondering if there is a way to manually select a feature, i.e.
> when a feature is clicked, I want to select a feature next to it as well.
> I can't seem to find any documentation on this, unfortunately.
You can use:
OpenLayers.Layer.Vector.getFeatureById()
or the undocumented/private/I can't find it in the api docs
OpenLayers.Layer.Vector.selectedFeatures array.
bye
maxx
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users