how to get coordinates of a polygon in OpenLayers

10,063

Found it finally!

vectors.features[0].geometry.getVertices()
Share:
10,063
pars
Author by

pars

Updated on June 04, 2022

Comments

  • pars
    pars almost 2 years

    I have been looking for how to determine coordinates of the points which consist a polygon(feature) in OpenLayers.

    Let's say I have created a polygon like the one in this example. I need to know the points which consist the polygon, so I can save them somewhere.

    I bet it is an easy one. I just couldn't find anything, probably I don't know what I should search for.

    Thanks in advance.

  • Bart Burg
    Bart Burg about 11 years
    Where did you find the vectors object? Or where can I find it in the example.
  • Bart Burg
    Bart Burg about 11 years
    Nevermind, I combined it with this example: dev.openlayers.org/releases/OpenLayers-2.12/examples/…
  • Paul Totzke
    Paul Totzke about 8 years
    dev.openlayers.org/examples/intersects.html Updated link from @BartBug's comment