mapbox / shp-write

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

Corrupt files with large geometry set #9

Closed newmanw closed 10 years ago

newmanw commented 10 years ago

I have run a few tests to verify that I can write shapefiles with this module and everything works great until I generate a shapefile with more than 500 features.

I am not sure if 500 is the exact number, but I get over a certain number of features and my zip file gets corrupt.

Have you done any kind of testing on size?

Also wondering if there is an easy way to write the shp buffer to disk instead of using JSZip? At least that way I can verify if its the shp buffer that is messed up or JSZip that is messing things up.

Example of trying to unzip zip file:
     $ unzip test.zip 
    Archive:  test.zip
      inflating: layers/Features_POINT.shp  
      inflating: layers/Features_POINT.shx  
      error:  invalid compressed data to inflate
      inflating: layers/Features_POINT.dbf  
      inflating: layers/Features_POINT.prj  
    $
newmanw commented 10 years ago

Annnnnnnnd I am doing it all wrong ;)

I was using compression var content = zip.generate({compression:'DEFLATE'});

instead of: var content = zip.generate({compression:'STORE'});

Sorry about that, working great.