[OpenLayers-Users] Selecting a feature programmatically?

Arnd Wippermann arnd.wippermann at web.de
Thu Nov 20 16:08:06 EST 2008


Hi,
 
i save in a drop down list the index of the features and for selecting i use
 
ctrlSelectFeature.select(lyr.features[idx]);
(with ctrlSelectFeature = new OpenLayers.Control.SelectFeature(lyr,
ctrlSelectFeatureOptions);)

Arnd Wippermann

  _____  

Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Phil Maloney
Gesendet: Donnerstag, 20. November 2008 12:19
An: users at openlayers.org
Betreff: [OpenLayers-Users] Selecting a feature programmatically?


Hi,
 
An OpenLayers newbie here, so apologies if I've skipped across this subject
being covered else where.
 
I am building a large-scale mapping interface allowing users to draw and
edit polygons. I want to list the polygons drawn (aka Google MyMaps style)
outside the map so the user can :
 
- Hover list items to highlight corresponding polygons on the map
- Click a list item to switch the corresponding polygon to "edit" mode
 
In essence, what is required to link external HTML to a polygon feature on
the map?
 
Code sample:
 
function listPolygon(event){
    var html = "<a
href=\"JavaScript:editPolygon('"+event.feature.id+"')\">"+event.feature.id+"
</a>";
    document.getElementById("polygonlist").innerHTML += html + "<br>";
}
 
function editPolygon(e){
   controls.select.select(e)
}
 
var vectors = new OpenLayers.Layer.Vector("Vector Layer");
vectors.events.on({featureadded": listPolygon});
 
 
I've attempted to use the selectControl.select method to achieve this with
the feature ID...but this is obviously not the correct way of achieving
this.
 
Any pointers appreciated.
 
Phil
 
 



  _____  

BigSnapSearch.com - 24 prizes a day, every day. Search
<http://clk.atdmt.com/UKM/go/117442309/direct/01/> now 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081120/a83a85fa/attachment.html


More information about the Users mailing list