mapbox / shp-write

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

the example test_linestring.js creates shapefile with null geometry #47

Open haoliangyu opened 7 years ago

haoliangyu commented 7 years ago

I run the example/test_linestring.js in the latest (v3.2.0) repo and it works with no error. But the generated shapefile is not rendered correctly at QGIS because the geometry is NULL, though the properties are properly saved.

screenshot from 2017-03-07 23-00-21

I run the script with Node v7.2.1 and open the shapefile with QGIS 2.16.1 in Ubuntu 16.04.

iacovlev-pavel commented 6 years ago

I have the same problem.

If you run a validity check on a shapefile created with shp-write the error is: unknown geometry type 0

POINT geometry type works fine, POLYLINE and POLYGON are not rendered in QGIS.

ximex commented 6 years ago

maybe this fix it: https://github.com/mapbox/shp-write/issues/44#issuecomment-310360267

iacovlev-pavel commented 6 years ago

Thank you very much, indeed that fixed the problem.

since the fix in #44 is related to parsing from JSON, to apply this fix when using the write function change in https://github.com/mapbox/shp-write/blob/master/example/test_linestring.js#L17 points, to [points],

sheindel commented 10 months ago

Good news: v0.4.2 is now available. Since #44 hopefully resolves this issue I'm hoping this latest change helps as well.

Less good news: Mapbox changed their deployment organization so this package is now hosted under a different package

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