ThinkGeo.com    |     Documentation    |     Premium Support

First and last vertices are the same

When drawing polygons, I noticed in the list of vertices that the first and last vertex are the same. Why is it done this way? I’m implementing a way for the user to edit the vertices, but I assume I have to worry about changing both the first and last every time they edit one of those?

If the first or last vertex is changed, will the other automatically be updated to match?

Thanks!

Hi Dan,

If the first vertex don’t equal to last vertex, it won’t be a polygon, it will be a line.

Our polygon have a outer ring, I think you should means edit the ring, but I am not sure how you edit it, if you edit it via our EditOverlay you don’t need worry about this problem, if you edit it by your custom code, please modify them at the same time, or you can show us your code, we can give you some advice.

Regards,

Ethan

Got it, thanks! I just wasn’t sure if internally it would add the last vertex to match the first if I created a polygon.

Hi Dan,

If you create polygon by our map API, the last vertex will added to match the first one.

If you build the polygon by your logic, please make sure add this vertex.

Regards,

Ethan