Using libgeos, when I buffer() a polygon and then getExteriorRing() [to make a slightly smaller outline copy of the polygon just inside the original], it seems that which point on the new geometry is the first/last point depends on more factors than I can control directly. When I do this repeatedly using different offsets to get multiple concentric copies of the original shape, the "starting" points on each subsequent shape are not all near each other as I had expected.
In the first specific case where I noticed this, an offset of 30 feet (and any offset between 30' and 60') resulted in a starting point near the right edge of the shape...but every offset that I tried above 60 feet resulted in a staring point at the leftmost point in the shape.
My initial though for how to deal with this goes something like:
- find the point on the derived geometry that is closest to the first point in the original geometry
- reorder the points in the derived geometry such that the point found in step 1 is the first (and last, these are closed) point
- Rinse, repeat for each buffered copy
Step 1 seems like geos::operation::distance::DistanceOp::nearestPoints(). Step 2 eludes me. Maybe that's because I'm trying to do this the hard way and I just don't know the name of the easy way? Is there a way to reorder the points in a GEOS LineString?
I should note that which point is first is important here because I need to treat that point as special for purposes of display and "end of path" detection...and having them all at relatively the same spot on each copy avoids jarring behavior for the user.