turf-buffer icon indicating copy to clipboard operation
turf-buffer copied to clipboard

Unable to Buffer on FeatureCollection of MultiPolygons

Open alukach opened this issue 10 years ago • 3 comments

When trying to buffer on a FeatureCollection of MultiPolygons(this file), the current Buffer code (turf-buffer v1.0.1 used by turf v2.0.2) prepares the data by running it through combine. If the FeatureCollection's first feature's geometry type (fc.features[0].geometry.type) is "MultiPolygon", no geometry property is appended to the FeatureCollection during the combine operation. When the bufferOp later passes a stringified version of feature.geometry (which is undefined) to an instance of jsts.io.GeoJSONReader, the error Uncaught TypeError: Cannot read property 'type' of undefined is thrown. Based on my reading of the GeoJSON Feature Collection Objects spec, it is not invalid for a FeatureCollection object to not have a geometry property on the root of the object.

This bug appears to have been fixed with this committed change, so this issue can likely be tagged wont fix. I'm more interested in created this issue so that:

  1. It can be logged as a known issue for users of turf v2.0.2 and any other turf versions relying on turf-buffer v.1.0.1.
  2. Propose that a subset of that test file make it's way into a test fixture (likely within turf-combine)
  3. Enquire as to when turf-buffer >v1.0.1 (the repo appears to be at v1.0.4 at this moment) will be rolled into a main version of turf.

alukach avatar Apr 04 '15 19:04 alukach

@alukach I added your data as a test fixture https://github.com/Turfjs/turf-buffer/commit/2ce85b201d6e2f1f512123818763e387cc8b7118

I will get a new turf version rolled out next week and close this issue then. Thanks!

morganherlocker avatar Apr 16 '15 20:04 morganherlocker

Any progress>?

MichaelMarkieta avatar Jul 27 '15 01:07 MichaelMarkieta

Ran into this issue, any further progress getting the fix incorporated into turf?

k-mahoney avatar Dec 02 '15 16:12 k-mahoney