On Nov 2, 2011, at 4:37 PM, Puneet Kishor wrote:

> 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);
>               }
>       });
>       

I am doing something wrong here trying to convert pixels to lat lng

        var bbox = bounds.toArray();
        var p1 = map.getLonLatFromPixel(bbox[0]);
        var str  = "Lat: " + p1.lat + " (Pixel.x:" + p1.x + ") Lon: " + p1.lon 
+ " (Pixel.y:" + p1.y + ")\n";
        alert(str);

produces the following alert

        Lat: NaN (Pixel.x:undefined) Lon: NaN (Pixel.y:undefined)


--
Puneet Kishor_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to