[OpenLayers-Users] Manually 'select' feature

Arnd Wippermann arnd.wippermann at web.de
Fri Jul 23 17:23:41 EDT 2010


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: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Alex Brandsen
Gesendet: Freitag, 23. Juli 2010 18:18
An: emmexx
Cc: users at openlayers.org
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 <emmexx at tiscalinet.it> 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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100723/2008d6e5/attachment.html


More information about the Users mailing list