[GIS] OpenLayers – How to construct OpenLayers.Bounds

openlayers-2

I would like to create Bounds for a layer but I am not sure in what order I have to provide the min_x / max_x and min_y / max_y coordinates.

is it correct to put it in that order: min_y, min_x, max_y, max_x

var bounds = new OpenLayers.Bounds.fromArray([{{ wms.min_y }}, {{ wms.min_x }}, {{ wms.max_y }}, {{ wms.max_x }}, ]);

Best Answer

The documentation for the Bounds constructor says:

bounds {Array(Number)} [left, bottom, right, top]

So you need to provide these parameters as numbers

var bounds = new OpenLayers.Bounds.fromArray([wms.min_x, wms.min_y, wms.max_x, wms.max_y]);