mapbox / shp-write

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

Problem: In final shapefile, I get less geometries than dbf rows. #64

Closed mikelaaf closed 10 months ago

mikelaaf commented 6 years ago

Hi, I am using in browser. I have tried several geoJson. I have always obtained the same result. Less geometries than dbf rows in final shapefile. I load in my page the js.

(with updated version 10/01/2018) I changed in this js the needed parts to work in JSZIP 3.0. //this //var generateOptions = { compression:'STORE' }; //if (!process.browser) { // generateOptions.type = 'nodebuffer'; //} //return zip.generate(generateOptions);

//with this var generateOptions = { compression: 'STORE', type: 'base64' }; if (!process.browser) { generateOptions.type = 'nodebuffer'; } return zip.generateAsync(generateOptions);

//this //module.exports = function(gj, options) { // var content = zip(gj, options); // location.href = 'data:application/zip;base64,' + content; //}; //with this module.exports = function (gj, options) { zip(gj, options).then(function (content) { location.href = 'data:application/zip;base64,' + content; }); };

I have revised a lot of times, but I don't find the problem. Any solution? Thanks in advanced.

hwbllmnn commented 5 years ago

In case you use point geometries I believe #69 will fix your problem.

sheindel commented 10 months ago

Good news: v0.4.2 is now available, which includes the fix in #69, so this should be resolved.

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