I'd like to reproduce the zoom levels of OpenLayers in PostGIS. I am not used to working with JavaScript and am having difficulties to find out the exact extent in meters of the default zoom levels of OpenLayers. I can't find it anywhere on the internet.

With the function ST_Expand I can create a shape similar to a zoom level. I would like to use that function and recreate the default zoom levels 12, 13 and 14 of OpenLayers. How do I do that?

I am thinking of finding out the distance of the extent from OpenLayers, and using that as an input for the function ST_Expand. But how do I find that distance?


1 Answer 1


You can get extent of map and zoom level using openlayers:(you must work with javascript for finding extent of map and zoom levels)

var zoom = map.getZoom();
// perhaps scale can help you for finding distance.
var scale = map.getScale();
var pageExtent = map.getExtent();

and you can find distance with map extent and zoom level.

i hope can help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.