Search code examples
javascriptopenlayers

How to get the coordinates of a dynamically drawn polygon in OpenLayers.


I read this question: how to get coordinates of a polygon in OpenLayers

Where the person appears to have found the answer, yet that documentation is weak at best. I am doing pretty much the same thing, using that example and working into an application. I need to grab the points from a polygon/box/point. I don't see anywhere in the code where vector.features.geometry.vertices would be useful as I am not using any of the geometry class. I just get the error of unable to find geometry.

Maybe I am using it wrong and I have no idea as there are really no examples for this but any help would be appreciated.


Solution

  • Shortly after posting it I stumbled upon this great example. http://dev.openlayers.org/releases/OpenLayers-2.12/examples/intersects.html