geojson_union_wasm
v0.1.0
Published
This simple WASM wrapper for geo::algorithm::unary_union to desolve or create the union of one or more GeoJSON strings. I created this because I was trying to combine very large GeoJSON files that took @turf/union longer then I wanted to find the union of
Readme
GeoJSON Union WASM
This simple WASM wrapper for geo::algorithm::unary_union to desolve or create the union of one or more GeoJSON strings. I created this because I was trying to combine very large GeoJSON files that took @turf/union longer then I wanted to find the union of. This library for my usecase is approximtely 18 times faster than @turf/union^7.3.1 when creating the uinion of cb_2018_us_county_500k.
Build
wasm-pack build --target bundler
The built code will be in the pkg folder
Usage
Basic dissolve
const unionString = geojson_union([
`{"features":[
{"geometry":{"coordinates":[[[4,0],[4,4],[8,4],[8,0],[4,0]]],"type":"Polygon"},"properties":{},"type":"Feature"},
{"geometry":{"coordinates":[[[0,0],[0,4],[4,4],[4,0],[0,0]]],"type":"Polygon"},"properties":{},"type":"Feature"}],
"type":"FeatureCollection"}`
]);
console.log('Union result:', JSON.parse(unionString));