Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffering sometimes drops non-contiguous shapes #25

Open
peterqliu opened this issue Oct 30, 2015 · 4 comments
Open

Buffering sometimes drops non-contiguous shapes #25

peterqliu opened this issue Oct 30, 2015 · 4 comments

Comments

@peterqliu
Copy link

running turf.buffer(fc, 0, 'miles') on this featurecollection

screen shot 2015-10-30 at 4 45 36 pm

gives me this:

screen shot 2015-10-30 at 4 45 29 pm

Removing the polygon to the far northeast seems to solve this problem; it's also the only poly with a hole, so that may have something to do with it.

cc/ @morganherlocker

@peterqliu
Copy link
Author

Another example, this time without visible holes. Original:

screen shot 2015-10-30 at 5 03 31 pm

turf.buffer(fc, 0, 'miles'):

screen shot 2015-10-30 at 5 04 14 pm

@tcql
Copy link
Member

tcql commented Oct 31, 2015

@peterqliu this might be the same as #12. turf-buffer got some updates and is currently v1.0.4, but the main turf release is still only including v1.0.1

@sbma44
Copy link

sbma44 commented Dec 18, 2015

I'm seeing the same behavior using v1.0.4 with quattroshapes' myanmar. confirmed the behavior in Mapbox Studio and QGIS:

image

studio is still chewing through the original myanmar geojson but here's the buffer -- you can see that features are missing

image

@sbma44
Copy link

sbma44 commented Dec 18, 2015

wound up with this workaround. pretty slow but gets the job done:

var fs = require('fs');
var buffer = require('turf-buffer');
var merge = require('turf-merge');
var polygon = require('turf-polygon');
var featurecollection = require('turf-featurecollection');

var p = JSON.parse(fs.readFileSync('quattro-myanmar.geojson'));

var out = [];
p.geometry.coordinates.forEach(function(coords, i) {
     out.push(buffer(polygon(coords), 1000, 'meters'));
});

console.log(JSON.stringify(merge(featurecollection(out))));

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants