Turf::intersection does not observe edge cases
I think this function does not observe the following edge cases:
- both lines are colinear (denominator == 0): the line segments could still intersect - the intersection would be another line segment
- what about the 180th meridian? what about line segments crossing the north and south pole?
- the current algorithm does not seem to count the start end end point as part of the line segment. This is a matter of definition, but usually at least the start point is counted as part of the line (i.e. the line segment is then closed-open)
https://github.com/mapbox/turf-swift/blob/19d184102927cfc6dba49647850c6fd3e1f5f336/Sources/Turf/Turf.swift#L15-L16
turf-point-on-line has since been replaced by turf-nearest-point-on-line, which calls out to turf-line-intersect, which at a glance seems to handle two of these issues.
what about the 180th meridian? what about line segments crossing the north and south pole?
This is a good point; geometries that straddle the antimeridian probably aren’t handled well by other methods in this library either. GeoJSON technically represents such geometries as multi-geometries, but many clients including the Mapbox Maps SDK work around this limitation by allowing longitudes to extend beyond ±180°.