question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

turf.concave() returned undefined at high precision

See original GitHub issue

Currently I’m using the turf.concave method to convert a feature of points to a polygon.

var hull = turf.concave( fc, 1, 'miles' )

Although I can’t make the polygon concave on points lower than 1 mile. If I try:

var hull = turf.concave( fc, 0.001, 'miles' )

hull returns undefined.

Any ideas? I need to get a better accuracy reading here. Thank you!!!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rowanwinscommented, Nov 22, 2015

Gday @roblav96

So it looks like it is the maxEdge setting that it throwing things out for you http://turfjs.party/#/de35288c26dd7d456ff9

By setting the maxEdge at .001 miles you are basically saying each polygon edge should only be .001miles however your points are not spaced that closely together.

So basically if your points are close together you can set a very small maxEdge however if your points are far apart you need to increase your maxEdge setting.

That’s probably the best I can offer without knowing more about your use case…

Cheers Rowan

0reactions
roblav96commented, Nov 21, 2015

Here are the points for this demo: http://geojson.io/#id=gist:anonymous/165bdfb1b1e396c6dbe7&map=15/42.3369/-71.1686

Here is the code:

turTurfItRealGoooood: function () {
    var features = []
    _.forEach( this.markers, function ( value, index ) {
        var point = turf.point( [ value.point.lng, value.point.lat ] )
        features.push( point )
    } )
    console.log( 'features >', features )

    var fc = turf.featurecollection( features )
    console.log( 'fc >', fc )

    var hull = turf.concave( fc, 0.001, 'miles' )
    console.log( 'hull >', hull )
},

The variable ‘fc’ are the points on the map I posted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Turf.js | Advanced geospatial analysis
Takes a set of points and returns a concave hull Polygon or MultiPolygon. Internally, this uses turf-tin to generate geometries.
Read more >
@turf/concave | Yarn - Package Manager
@turf/boolean-within. Boolean-within returns true if the first geometry is completely within the second geometry. The interiors of both geometries must ...
Read more >
turf/concave
Start using @turf/concave in your project by running `npm i @turf/concave`. There are 5 other projects in the npm registry using @turf/concave.
Read more >
PostGIS 2.5.9dev Manual
higher resolution table. These are generated along-side the main raster table when you use the -l switch in raster loading or can.
Read more >
Whitebox Workflows for Python User Manual
This tool can be used to reduce the grid resolution of a raster by a user specified ... Therefore, polygons of complex shaped...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found