please could someone help me and bless me with an example of how to get coordinates from a polygon in OpenLayers?


3 Answers 3


you can get the coordinates of your shape as below code:


and also you can get covered area, centroid of your shape, vertices of ypur shape, length or geodesic area.

if you want specific feature bounds, you can write order of your feature [i] place like this:


and below code will give all bounds of your features example :

var ft = vectorLayer.features;
for(var i=0; i< ft.length; i++){

I hope that will be useful for you....

  • Please could you maybe give me an example of this as I am stuck. Feb 7, 2012 at 14:22
  • @CaptDragon Question asked. lol. Feb 7, 2012 at 21:15
  • @BlakeLoizides Aragon has it right. This is how you get coordinates from a polygon. In your comment on this question thought it seems like you're having trouble with deleting a polygon now? if so it's a separate question which would merit a new question entry.
    – CaptDragon
    Feb 7, 2012 at 21:20


getVertices() returns the polygon POINT coordinates..


This is how to retrieve vertices:


GetVertices() returns Polygon points coordinates

  • 3
    Can you improve (edit) your answer with further details? Thanks. Oct 25, 2013 at 9:17

Your Answer

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

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