mbloch / mapshaper

Tools for editing Shapefile, GeoJSON, TopoJSON and CSV files
http://mapshaper.org
Other
3.66k stars 529 forks source link

targets.forEach is not a function #604

Closed hyperknot closed 9 months ago

hyperknot commented 9 months ago

I'm trying to run the following command:

mapshaper -i in.geojson -snap interval=1 -o output.geojson

I receive the following error:

TypeError: targets.forEach is not a function
    at applyCommandToEachTarget (/Users/user/Documents/dev/temp/sandbox/node_modules/.pnpm/mapshaper@0.6.43_@types+geojson@7946.0.11/node_modules/mapshaper/mapshaper.js:28457:13)
    at runCommand (/Users/user/Documents/dev/temp/sandbox/node_modules/.pnpm/mapshaper@0.6.43_@types+geojson@7946.0.11/node_modules/mapshaper/mapshaper.js:43846:9)
    at nextCommand (/Users/user/Documents/dev/temp/sandbox/node_modules/.pnpm/mapshaper@0.6.43_@types+geojson@7946.0.11/node_modules/mapshaper/mapshaper.js:44188:7)
    at Immediate.<anonymous> (/Users/user/Documents/dev/temp/sandbox/node_modules/.pnpm/mapshaper@0.6.43_@types+geojson@7946.0.11/node_modules/mapshaper/mapshaper.js:360:11)
    at process.processImmediate (node:internal/timers:478:21)

The input contains a few non-multi polygons, nothing else and is quite small. I'd like to align their edges to each others, so that there are no gaps between them.

Version is 0.6.43.

mbloch commented 9 months ago

Hi! Thanks for reporting this! I just published v0.6.44, which has a fix. I'm not sure how well the -snap command will work to clean up your geometry, but at least this bug should be fixed.

hyperknot commented 9 months ago

Thanks, works perfectly!