[OpenLayers-Users] Handler.Box units
Puneet Kishor
punk.kish at gmail.com
Wed Nov 2 17:37:21 EDT 2011
I am reusing the sample code from the Handler.Box documentation
var control = new OpenLayers.Control();
OpenLayers.Util.extend(control, {
draw: function () {
// this Handler.Box will intercept the shift-mousedown
// before Control.MouseDefault gets to see it
this.box = new OpenLayers.Handler.Box(
control,
{done: this.notice},
{keyMask: OpenLayers.Handler.MOD_SHIFT}
);
this.box.activate();
},
notice: function (bounds) {
OpenLayers.Console.userError("bounds: " + bounds);
var bbox = bounds.transform(proj.google, proj.latlng).toBBOX();
OpenLayers.Console.userError("bbox: " + bbox);
}
});
To my uneducated surprise, the bounds seem to be in pixels instead of my expected map projection, google, in this case. Am I mistaken in my assumption. How do I get the values in latlng?
On a related note: I am trying to create a capability where a user draws a rubber-band box which sends a query to the server which returns with a bunch of results, perhaps a maps as well. Is the above the right approach?
--
Puneet Kishor
More information about the Users
mailing list