Creating a Box Control over an area of the map with OpenLayers
- by Bernie Perez
I am using OpenLayers to create a box of interest with my program. I am using this code:
var control = new OpenLayers.Control();
OpenLayers.Util.extend(control, {
draw: function () {
this.box = new OpenLayers.Handler.Box( control,
{"done": this.notice},
{keyMask: OpenLayers.Handler.MOD_SHIFT});
this.box.activate();
},
notice: function (bounds) {
areaSelected(bounds);
}
});
map.addControl(control);
to capture the "Shift Create a Box" control and use the area selected as my area of interest. However the values come back as pixels. But I want Longitude and Latitude, not pixels. The Mouse Position control does show the correct long & lat. I really don't care how to box is created, I just want an easy way for the user to select a area of the map and I need to get the lat & longs of the area. (Box, Circle, doesn't matter)