I have a database with cities and values for: bb_left, bb_top, bb_right, bb_bottom, locate_x, and locate_y.
Here's an example:
city - bb_left - bb_top - bb_right - bb_bottom - locate_x - locate_y
geneve - 493485 - 124865 - 506522 - 110870 - 499910 - 117983
The data was used for an older application using OpenLayers 2 which supports a bounding box containing just 4 values, however in OpenLayers 3 – I must create an extent with co-ordinate points but I am unsure how to create the co-ords based on the bounding box data.
Is this even possible to convert ?
Best Answer
ol.Extent is simply an array of 4 numbers. But you can translate this extent to a polygon with the function ol.geom.Polygon.fromExtent. And this polygon can be used to create a feature, so that you can display the bounding-box.