Using Turf, I'm trying to determine the points at which a line (LineString) meets the boundaries of a polygon.

Turf has the ability to do point-in-polygon/point-on-line and polygon intersections etc, but I can't figure out a way to get Turf to give the answer to the question "what are the points at which this LineString meets the boundaries of this Polygon".

The only options I've come up with so far is to enumerate the points of the polygon as line-segments and then use a line intersection algorithm. I just hoped there was a more "Turf" way of doing it.

PS - I already asked this over on stackoverflow but someone suggested I try here on gis.stackexchange.com

  • I had a look at Turf before, it mainly deals with point-polygon spatial relationships. Provided you are processing "boundaries of a polygon", which basically implies that the relationship should be in between line strings and I think what you are doing is the only way, i.e., converting polygon to line strings, with Turf.
    – fatih_dur
    Nov 11, 2015 at 14:20

1 Answer 1


Ultimately, turfjs does not seem to have an API for doing this.

I was able to get the answer I wanted by enumerating the points in the polygon from the GeoJSON object to construct a sequence of line segments and then I used maxogden/geojson-js-utils linesIntersect function to test for intersection points.

PS - this is a copy of the answer from the main stackoverflow question I posted

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.