I'm trying to figure out if there is a method in rgeo or a way to calculate this in ruby or a way to do it in PostGis quickly.
I have a line that splits multiple polygons. I run a query in PostGis that returns each splitting point, but they are out of order.
I have tried to use ST_Dump
on the line and put ORDER BY dmp.path
, but this doesn't work (as I have multiple of the same point, thus causing issues with the order).
Since I'm using the rgeo gem, I have been trying to figure out a way to get the index of that point along the route.
So, if I had 100 points to make up the line, I have one polygon intersection, I would get two points back from my query. I would then need to figure out at what index that point is along the line. Since it is on the line, but isn't one of the points that make up that line, I'm not sure how to figure out what index that point would be on the line.
I know ST_LineSubstring
and ST_LineLocatePoint
with ST_LineInterpolatePoint
can give me a point on the line in PostGis, but I don't know how to figure out at what index.
I'm very new to the gis (PostGis) and rego stuff, so if I'm missing something I apoligize. I have tried to figure out everything I could from the limited rgeo docs and postgis docs.
Thanks
question from:
https://stackoverflow.com/questions/65829066/get-closest-point-index-on-a-line-in-rgeo-or-postgis 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…