turf-buffer
turf-buffer copied to clipboard
Unable to Buffer on FeatureCollection of MultiPolygons
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:
- It can be logged as a known issue for users of
turfv2.0.2and any otherturfversions relying onturf-bufferv.1.0.1. - Propose that a subset of that test file make it's way into a test fixture (likely within
turf-combine) - Enquire as to when
turf-buffer>v1.0.1(the repo appears to be atv1.0.4at this moment) will be rolled into a main version ofturf.
@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!
Any progress>?
Ran into this issue, any further progress getting the fix incorporated into turf?