ThinkGeo.com    |     Documentation    |     Premium Support

Select Feature for Editing from EditOverlay via javascript

How can I programatically simulate clicking a feature while in Modify mode?


I have the following code which adds the feature to the EditOverlay from WellKnownText:




var layer = Map1.GetOpenLayersMap().getLayersByName('<%=Map1.EditOverlay.Name %>')[0];
var wkt = new OpenLayers.Format.WKT();
layer.addFeatures(wkt.read(THE_WELLKNOWNTEXT));


This works fine, but I'd like to eliminate the step of making the user click the shape to select it for editing.


I've looked around, and it looks like I need to use the "selectFeature()" function of OpenLayers.Control.ModifyFeature. I'm guessing there is already one of these somewhere, but I'm not sure what you guys have going on under the hood.


Any ideas?



Rob,  
  
 We cannot Select Feature with program using the current version. We’ll see if the future OpenLayers can support this. You can select a feature by hovering it (instead of clicking on it) though, we didn’t integrate this in but you can implement yourself if you are interested. Here is the sample of drawing/selecting feature of OpenLayers.  
  
 openlayers.org/dev/examples/select-feature.html 
  
 Thanks, 
  
 Ben