Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Aug 15 01:40
    yukha-dw commented #2307
  • Aug 14 22:41
    jfoclpf commented #1743
  • Aug 14 22:40
    jfoclpf commented #1743
  • Aug 14 10:01
    alirezaalavi87 opened #2322
  • Aug 08 21:43
    smdjeff commented #1679
  • Aug 08 20:22
    Stophface opened #2321
  • Aug 07 06:20
    stebogit closed #2320
  • Aug 07 06:20
    stebogit commented #2320
  • Aug 06 06:53
    ontheway16 opened #2320
  • Aug 05 16:28
    stebogit commented #2258
  • Aug 05 10:30
    btisdall commented #2258
  • Aug 05 08:01
    turbolego opened #2319
  • Aug 05 07:34
    stebogit labeled #2318
  • Aug 05 07:33
    stebogit commented #2318
  • Aug 05 07:27
    stebogit commented #2318
  • Aug 04 13:43
    stebogit commented #2315
  • Aug 04 13:43
    stebogit reopened #2315
  • Aug 04 07:47
    yukha-dw closed #2315
  • Aug 04 07:47
    yukha-dw commented #2315
  • Aug 04 07:33
    robinsummerhill commented #2155
Robert Laverty
@stepankuzmin great module man!
Stepan Kuzmin
Thanks @roblav96. It’s pretty simple, though
Robert Laverty
does anyone know how to go about simplifying a feature collection of points? i have a point on a line every meter for 1000 meters or so. i want to simplify it to about 250 points or so. i tried using turf.simplify but it didnt like my feature collection:
var fc = turf.featurecollection( features )
console.log( 'fc >', fc )

if ( fc.features.length > 0 ) {
    var simplified = turf.simplify( fc, 0.01, false )
    console.log( 'simplified >', simplified )
Uncaught TypeError: Cannot read property 'type' of undefined
Robert Laverty
does anyone know how to produce a 16 verticy polygon from a circle? so I provide one point and the radius and i need to return a polygon from that. possible?
and it turns out you cant simplify a feature collection of points :X
Tom MacWright
@roblav96 at a low level, i'd do it by using https://github.com/mapbox/spherical, with each angle differing by 360/16 degrees, and then using all of the points as coordinates in the coordinate array of a geojson polygon
Robert Laverty
@tmcw well it turns out my rethinkdb driver has this out of the box :D
Tom MacWright
Nikhil Murarka
hi any plan on added network analysis/topology checks to turf ? like if we want to find conflicting one ways in current extent ?
Taylor Mansfield
Hi guys, I need some help converting mapbox vector tiles to GeoJSON in the browser so I can run turf operations on that layer. Any ideas? I know there are some Node libraries out there that can do this, but I really need to do it in the browser.
Robert Laverty
@lavahot i dont quite understand what youre asking, i use turf with mapbox-gl-js in the browser no problem
Taylor Mansfield
@roblav96 I'm using leaflet, not mapbox directly.
turf only takes GeoJSON arguments, not vector tiles, so I need some way to convert the data in that layer to GeoJSON just to use it with turf.
Erinç Fırtına
@lavahot as I know, leaflet has toGeoJson method for that.
Taylor Mansfield
@EricMcRay leaflet does not natively read MVTs. I had to use a plugin for it, which AFAIK does not have a toGeoJson method.
Richard Astbury
Hi All. I'm having some trouble trying to get buffer to work.
when I attempt to create a buffer from this polygon, it seems to miss the last point off : https://gist.github.com/richorama/0dd4a2ce32d357279623
so my buffer looks like this ^
with 3 coords, rather than 4
Per Liedman
@richorama in GeoJSON, the last coordinate in a polygon's ring should be equal to the first
so you should duplicates the first coordinate to get correct results
Richard Astbury
ah ha!
Per Liedman
leaflet will let you get away with not duplicating it, however, so that's why it look correct anyway.
Giulio Ungaretti
hi. I created a Turf - node for node-red. It's my first project in this field and I just wanted to be sure if thats permitted.
Stefano Borghi
hello everybody, I have some issue to figure out how to create a contour map with turf, could anybody help?
Stefano Borghi
I can create isolines but how do I create actual polygons to be filled with color in a (google) map?
Lucien Knechtli
Hi, I'm trying to use turf.js with my application, but I'm getting an error when the code is evaluated: Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'
The referenced lines are lines 5625-5628 in the un-minified turf.js I got off github for v2.0.0
for reference / context, this is the function:
function orientation(n) { var pos = [] var neg = [] var m = matrix(n) var args = [] for(var i=0; i<n; ++i) { if((i&1)===0) { pos.push.apply(pos, determinant(cofactor(m, i))) } else { neg.push.apply(neg, determinant(cofactor(m, i))) } args.push("m" + i) } var posExpr = generateSum(pos) var negExpr = generateSum(neg) var funcName = "orientation" + n + "Exact" var code = ["function ", funcName, "(", args.join(), "){var p=", posExpr, ",n=", negExpr, ",d=sub(p,n);\ return d[d.length-1];};return ", funcName].join("") var proc = new Function("sum", "prod", "scale", "sub", code) return proc(robustSum, twoProduct, robustScale, robustSubtract) }
is there any way around this without modifying the CSP?
RYeah Sh
is there a showcase of turf?
Naveen Dandiprolu

Hi. I am trying to use the median / aggregate functions in my node application. I get an error : turf.aggregate is not a function. Looks like these functions are not installed through npm.. Is there a way around ?


Any ideas on looking for polygons in polygons? Both total enclosure and also partial. Points inside is easy enough, but keen to see if there are some clever ways of shapes in shapes.
Stefano Borghi
hello, I implemented a new version of contour module using marchingsquare.js and I thought it could be useful to somebody else
I created a PR some time ago (Turfjs/turf-isobands#7) on the turf-isobands moduel/package, but I haven;t received any feedback yet
is anybody going to resume the isobands module? in my understanding the module was set aside for it was not working properly
Peter Kupietz
Hi! I made a small helper to filter polygon rings. When you union simplified polygons you can filter out slivers from your resulting polygon. See https://github.com/kuuup/turf-filter-rings
David Das Kell
Hi all- does turf-intersect work for polygons with holes? Have a use case where everything works fine until a polygon with holes turns up!
Will idw work with evenly spaced points? The z value is the same for all polygons when i run it.
hi guys, how can I get turf hex grids to auto update without getting user to hover over each polygon
What's wrong with turf-ui-builder? I don't see point, featureCollection, etc.
Thomas Grice
any reason turf.intersect(poly1, poly1) would return undefined?
Because there is no intersection?
I wanted to ask if there is some simple way to construct a "sector"-like polygon given point, radius, bearing and angle. Right now I construct a circle (of given radius) and subtract from it two rectangles so that the sector is formed. Maybe there's an easier way like some built-in functionality, that I've overlooked?
Karine Hubner