[GIS] How to get the values returned by an OpenLayers bounds object in Longitude / Latitude format

coordinate systemopenlayers-2

I've created a map and added a layer using the OpenLayers library:

map = new OpenLayers.Map('map');
var gphy = new OpenLayers.Layer.Google("Google Physical", {type: G_PHYSICAL_MAP});
map.addLayer(gphy);

The map loads and I can center my map:

map.setCenter(new OpenLayers.LonLat(-114.922485, 56.400224), 4);

I've then created a box handler, but the bounds returned aren't in Longitude / Latitude format. When drawing a box around the center of my map, my bound object returns the following:

left-bottom=(278,245) right-top=(304,211)

How can I convert these values into Longitude / Latitude?

The resolution thanks to unicoletti:

map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.left, bounds.bottom))

Best Answer

Assuming that those are pixel coordinates you can use:

map.getLonLatFromPixel

or one of the other pixel to lat/lon conversion functions of the map object. Check the documentation relevant to your OL version for a detailed explanation.