mapbox / shp-write

create and write to shapefiles in pure javascript
BSD 3-Clause "New" or "Revised" License
290 stars 186 forks source link

Error occured while write polygon. #87

Open YuWebGIS opened 2 years ago

YuWebGIS commented 2 years ago

I modify a function

function justCoords(t) { if (t.geometry.coordinates[0] !== undefined && t.geometry.coordinates[0][0] !== undefined && t.geometry.coordinates[0][0][0] !== undefined) { return t.geometry.coordinates[0]; } else { return t.geometry.coordinates; } }

to

function justCoords(t) { if (t.geometry.coordinates[0] !== undefined && t.geometry.coordinates[0][0] !== undefined && t.geometry.coordinates[0][0][0] !== undefined && t.geometry.coordinates[0][0][0][0] !== undefined ) { return t.geometry.coordinates[0]; } else { return t.geometry.coordinates; } }

Simple polygon have three [] in geometry, and multiple have four.

sheindel commented 10 months ago

Hello! We should now be able to write correctly write the basic shapes, so I'm hoping this is resolved. Can you try with the latest version and close this issue if it is resolved? Thanks!

Mapbox changed their deployment organization so this library is now hosted under a different package name

@mapbox/shp-write https://unpkg.com/@mapbox/shp-write@latest/shpwrite.js