In openlayers 2 there was a method "toGeometry()" on Openlayers.Bounds() that could convert that bounds into a Geometry. I migrated from ol2 to ol3 and I try to find a solution to easily do the same thing without having to define a ring with all the coordinates and then using the constructor of ol.geom.Polygon(ring). The API is not helping.. Any ideas?


I guess you are looking for ol.geom.Polygon.fromExtent(extent).

Try to uncheck the "Stable Only" checkbox in the API docs to see all methods.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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