# How is the first vertex in a polygon chosen?

I was wondering about the method/specification of choosing the first vertex in a polygon. Let's say that I have polygon that has 4 vertices, `([0 0] [10 0] [10 10] [0 10])`. Which of them will be the first node when iterating through them (and why)?

My thought is that the vertex with minimal x-value is chosen (and if there are several vertices that share the same x-coord then the vertex with minimal y-value among them is chosen),also the nodes above would be represented this way in a GeoJSON:

``````[[[0 0]
[10 0]
[10 10]
[0 10]
[0 0]]]
``````

I am using OSM data that is stored in PostGIS and the polygons will be examined by simple software that I wrote.

• there is no reason for picking any one vertex over any other in most cases so I would not expect there to be a "good" answer to this in general. Which program/language/toolkit are you interested in Apr 15, 2020 at 13:06
• This is going to depend on a) the software that created the data set, b) the software that is reading the data set, and c) the format that the dataset is being stored. And apart from a brief mention of geoJSON you've given us no clues to go on! But in any case, all vertices are equivalent and any software that expects any special ordering will break. Apr 15, 2020 at 13:06
• I have edited the question and added the requested information. Is there anything more that is unclear? Apr 15, 2020 at 13:15
• Too much information! I've zapped your supplementary question since we should concentrate on one question first. Apr 15, 2020 at 13:46

• Functions may also re-order vertices because by definition the order of the vertices does not matter if the winding direction is correct. Therefore PostGIS returns "true" for `SELECT ST_Equals(ST_GeomFromText('POLYGON (( 4 8, 4 7, 3 7, 3 8, 4 8 ))'),ST_GeomFromText('POLYGON (( 3 8, 4 8, 4 7, 3 7, 3 8 ))'))` Apr 15, 2020 at 13:30