Open quincylvania opened 1 month ago
Got it, that makes sense. What would you expect line_midpoint
to do on a multilinestring?
Also is there any polygon equivalent that might make sense? Otherwise I could just make it fail and log a warning if it gets used on a polygon.
Actually this might be the line equivalent of the existing "innermost point" feature I added to the java API that uses the pole of inaccessibility algorithm on polygons. That would imply for multilinestrings it just emits one point at the midpoint of the longest linestring.
I could add a few geometry types to yaml:
innermost_point
that does pole of inaccessibility on polygons, midpoint on lines, and just passes through the point for pointsline_midpoint
that's an alias for innermost_point
but limits to just lines.That would imply for multilinestrings it just emits one point at the midpoint of the longest linestring.
I think this is fine, but at least for OSM I would expect multiple lines with shared endpoints to be treated as a single line for this purpose. For example, a standard route or waterway relation consists only of lines connected end-to-end, so I would expect the "innermost point" to be at the midpoint of the combined route. For a complete loop the "midpoint" could be anywhere along any line.
- innermost_point that does pole of inaccessibility on polygons, midpoint on lines, and just passes through the point for points
- line_midpoint that's an alias for innermost_point but limits to just lines.
This sounds good. Maybe a third option in case someone wants to match only polygons and not lines?
innermost_point that does pole of inaccessibility on polygons, midpoint on lines, and just passes through the point for points line_midpoint that's an alias for innermost_point but limits to just lines.
I have the same need, and looks good to me too.
Is your feature request related to a problem? Please describe.
890 was a great addition and opened up a lot of functionality for us at OpenTrailMap. But now we're running into an issue where the point doesn't always emit where we want it.
The
line_centroid
type can put the point off the line for curved features, which isn't ideal at high zooms.The
point_on_line
just picks one of the middle nodes. If there's not a node near the center, it looks strangely.Describe the solution you'd like An additional line-to-point geometry type that emits the geometric midpoint of the line would do the trick. I would leave the existing geometry types in place.
Describe alternatives you've considered We could instead use an icon symbol label on the way at high zooms, but this would be cumbersome to manage.