[OpenLayers-Users] Selecting a feature programmatically?

Phil Maloney pj_maloney at hotmail.com
Thu Nov 20 06:19:06 EST 2008


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
 
 

_________________________________________________________________
See the most popular videos on the web 
http://clk.atdmt.com/GBL/go/115454061/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081120/42e2479e/attachment.html


More information about the Users mailing list