Turf is a collection of independent Javascript modules providing common geospatial capabilites, against geometries encoded in GeoJSON format. It can be run in a Nodejs environment or included in a minified form in a script tag. It draws heavily on the JSTS (Javascript Topology Suite) library under the hood.
Questions tagged [turfjs]
289 questions
3
votes
2 answers
How to clip and show clipped vector geometry in OpenLayers 5.3.0
I have to clip vector layer based on the main/restriction vector layer. Upon drawing, if some part of the drawn layer is outside restriction layer, clip area that is outside restriction layer.
Example 1.
As we can see, part of the bottom border is…

Svinjica
- 2,389
- 2
- 37
- 66
3
votes
1 answer
TurfJS get bbox given two Points
I'm trying to move a client side method on the backend:
The client side method is using TurfJS and Leaflet to perform some operations. The only problem is that server side (nodejs) window is not available, hence I cannot use Leaflet.
I'm looking…

Caius
- 2,084
- 6
- 31
- 47
3
votes
1 answer
Select all neighbor polygons algorithm
I am trying to select all neighboring polygons in mapbox gl using turf.js and I am using
turf.intersect(poly[0], item);
And sometimes it is fine, but it looks like the input polygons data is bad, and it looks like there is some gaps between…

SERG
- 3,907
- 8
- 44
- 89
3
votes
1 answer
Move polygon points based on center location?
Would someone have an example using Turf moving all polygon points from one location to another based on a new center point?
For example, let’s say I have calculated a center based on where the points were originally created.
Then I need to move…

xspydr
- 3,030
- 3
- 31
- 49
3
votes
1 answer
Detect intersection Turf.js, First and last Position are not equivalent
Utilizing Turf.js version 3.0.12. The function below should return the intersection between the two polygons or null if they do not intersect. The polygons do intersect. I have tried several different polygons and receive the same error:
"Error:…

Captain Caveman
- 1,448
- 1
- 11
- 24
3
votes
1 answer
How to place squares along the line? (Geojson+mapbox)
I have a rectangular and need to fill it with squares.
I find the center line and want to place the squares along that line.
But is there any simple method to draw a square in mapboxgl with any other libs like turfjs?
Like set the center of the…

SERG
- 3,907
- 8
- 44
- 89
3
votes
3 answers
TurfJs union - How to ignore point which are inside but with little bit difference in union?
I have used 2 geojson object for polygon. It's too large that I can't post it here. Now I am using TurfJs to make the union of this polygon geojson and plotting it on the map. But it's not working properly.
I think little bit points in the middle…

Mayur Patel
- 1,741
- 15
- 32
3
votes
1 answer
Distance between two points over a path with turf.js
It's possible to calculate the distance between two points over a line path using turfjs? How?

Federico González Brizzio
- 682
- 1
- 8
- 15
3
votes
1 answer
Mapbox Overlapping Circles
Does anyone know a way to make overlapping circles in mapbox show the same color and only have the border around the outer edge display?
I have this:
And I made this in photoshop for what I want:

Lereveme
- 1,614
- 2
- 15
- 18
3
votes
2 answers
Find co-ordinates where LineString intersects a Polygon border in turfjs
Is there a way in Turfjs to determine the co-ordinates at which a LineString intersects with the border of a polygon?
There's a number of ways to find out if a point is within a polygon and a number of ways to find out if a point is on a line and so…

rifboy
- 195
- 2
- 6
3
votes
0 answers
What is "Uncaught TopologyError: no outgoing dirEdge found" in Turf.js?
I am attempting to use turf.concave to get a polygon. It works with most of the points I put in, but with one set of points, it takes offense and throws the following error:
Uncaught TopologyError: no outgoing dirEdge found [ (-121.9717867,…

samcorcos
- 2,330
- 4
- 27
- 40
2
votes
1 answer
Plot paths across a polygon of a given width, parallel to the longest edge, covering the full polygon, using leaf.js and turf
I'm trying to build something using Leaf.js and (as suggested by ChatGPT) Turf.
I have a map and GeoJSON polygon plotted on it just fine: