mbloch / mapshaper

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

geojson from points #637

Open chris3522 opened 2 months ago

chris3522 commented 2 months ago

Hello, is there a command line way to draw a single geojson that surrounds the lat lon points. Lines can join the outermost points for example but there may be cases (red zone) where this is difficult. The lat lon points are contained in a csv (cf file). Many thanks

surround

BV_GRAND-PARIS1FRANXL1S100.csv

chris3522 commented 2 months ago

I try an intermediate solution by creating a bounding rectangle but I get an error with this command:

csvPoints = `./BV_GRAND-PARIS__1__FRANXL1S100.csv`
mapshaper.runCommandsXL(`-i ${csvPoints} -calc 'xmin=min(lon)' -calc 'ymin=min(lat)' -calc 'xmax=max(lon)' -calc 'ymax=max(lat)' -rectangle 'bbox=xmin,ymin,xmax,ymax'`)

because maphaper cannot find the variables xmin,ymin,xmax and ymax

chris3522 commented 2 months ago

Here the error:

Error: Command failed:/mapshaper/bin/mapshaper -i ./BV_GRAND-PARIS__1__FRANXL1S100.csv  -calc 'xmin=min(LON),ymin=min(LAT),xmax=max(LON),ymax=max(LAT)' -rectangle 'bbox=xmin,ymin,xmax,ymax'
Allocating 8 GB of heap memory
[i] Auto-detected number fields: INDEX, LON, LAT
[calc] xmin=min(LON),ymin=min(LAT),xmax=max(LON),ymax=max(LAT):  2.23
Error: [rectangle] Missing rectangle extent
Run mapshaper -h to view help

    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:514:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:514:28)
    at Pipe.<anonymous> (node:net:337:12) {
  code: 1,
  killed: false,
  signal: null,
  cmd: "/nodejs/bin/node --max-old-space-size=8000 /mapshaper/bin/mapshaper -i ./BV_GRAND-PARIS__1__FRANXL1S100.csv  -calc 'xmin=min(LON),ymin=min(LAT),xmax=max(LON),ymax=max(LAT)' -rectangle 'bbox=xmin,ymin,xmax,ymax'"
}