Please suggest an algorithm for determining the centroid of a polygon made of geographic coordinates?
Position {lat, lon}
Polygon = vector of Positions
Can your solution for a finding the intersection of of two geodesics (based on a gnomonic projection) be utilised to find the centroid of a triangle made of geodesics? If so, I have an algorithm in my mind that is based on decomposing the polygon into triangles like so:
1. Connect the first vertex with all others (except last) to form a fan of triangles.
2. Compute the centroid of these triangles. The centroids of these triangles represent another polygon
3. Repeat the process this the polygon is thus reduced to a triangle. The centroid of this triangle is a centroid of the original polygon
What do you think about this method?
Any suggestions or corrections are appreciated. Thanks
VG
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There are three problems with your suggested scheme:
The gnomonic projection is a bad starting point because it badly distorts areas. An equal area projection, e.g., Albers conic, is a better choice. But understand that this would only "work" if your polygon had a relatively small extent, say 100 km or less.
Your proposed triangulation scheme then has the problem (a) that it will be slow, O(n^2), I think, and (b) that it's wrong since you don't weight the vertices of the succeeding triangles according to the area of their parents.
I recommend using the formula for the centroid of a polygon (Google this!).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2024-02-21
Thanks for your suggestions. I'll look into Albers Conic projections.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Please suggest an algorithm for determining the centroid of a polygon made of geographic coordinates?
Position {lat, lon}
Polygon = vector of Positions
Can your solution for a finding the intersection of of two geodesics (based on a gnomonic projection) be utilised to find the centroid of a triangle made of geodesics? If so, I have an algorithm in my mind that is based on decomposing the polygon into triangles like so:
1. Connect the first vertex with all others (except last) to form a fan of triangles.
2. Compute the centroid of these triangles. The centroids of these triangles represent another polygon
3. Repeat the process this the polygon is thus reduced to a triangle. The centroid of this triangle is a centroid of the original polygon
What do you think about this method?
Any suggestions or corrections are appreciated. Thanks
VG
There are three problems with your suggested scheme:
The gnomonic projection is a bad starting point because it badly distorts areas. An equal area projection, e.g., Albers conic, is a better choice. But understand that this would only "work" if your polygon had a relatively small extent, say 100 km or less.
Your proposed triangulation scheme then has the problem (a) that it will be slow, O(n^2), I think, and (b) that it's wrong since you don't weight the vertices of the succeeding triangles according to the area of their parents.
I recommend using the formula for the centroid of a polygon (Google this!).
Thanks for your suggestions. I'll look into Albers Conic projections.