Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: This method has been removed in JSZip 3.0, please check the upgrade guide. #48

Closed
ghost opened this issue Mar 30, 2017 · 6 comments

Comments

@ghost
Copy link

ghost commented Mar 30, 2017

Hi,
I'm using the latest version 0.3.2 and when executing shpwrite.download() I get following Error:

Error: This method has been removed in JSZip 3.0, please check the upgrade guide.

Do I do something wrong or is it a bug? Is there a work-around?

Here is my code;:

var shp_options = {
folder: 'shapefiles',
types: {
point: 'points',
polygon: 'polygons',
polyline: 'polyline'
}};
var geojson_format = new OpenLayers.Format.GeoJSON();
var features_geojson = JSON.parse(geojson_format.write(drawLayer.features,false));
shpwrite.download(features_geojson,shp_options);

Cheers,
Steffen

@malvandi
Copy link

malvandi commented Jun 6, 2017

Do you have solved it?
I have the same problem.

@ghost
Copy link
Author

ghost commented Jun 6, 2017

no, unfortunately not. I still don't have the shape write implement. Until now I can live with geojson...

@simtrax
Copy link

simtrax commented Jun 9, 2017

I have this issue as well.

@Miroko Miroko mentioned this issue Jun 14, 2017
@ximex
Copy link

ximex commented Jun 14, 2017

I fixed it by hand.
Replace this:

// ##### replace 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);

// ##### and 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;
  });
};

Look at: https://stuk.github.io/jszip/documentation/upgrade_guide.html

Edit:
I use FileSaver.js (https://github.com/eligrey/FileSaver.js) and have to change type:'base64' to type:'blob'
So:

shpwrite.zip(data, options).then(function(content) {
  saveAs(content, 'export.zip');
});

tnixeu pushed a commit to tnixeu/shp-write that referenced this issue Sep 13, 2018
tnixeu added a commit to tnixeu/shp-write that referenced this issue Sep 17, 2018
ldoreille added a commit to ldoreille/shp-write that referenced this issue Feb 11, 2019
@kmanzana
Copy link

kmanzana commented Jan 7, 2020

Does it make sense to introduce this change via a PR?

adnicolas pushed a commit to adnicolas/shp-write that referenced this issue Nov 19, 2020
paschendale added a commit to paschendale/webgente-node that referenced this issue Mar 17, 2021
Há a possibilidade posterior de desenvolvimento do traçado em shapefiles. Deixei os scripts de importacao da biblioteca shp-write do mapbox comentados no footer. Encontrei alguns problemas que aparentemente nao foram solucionados pelos mantenedores do código.

mapbox/shp-write#48

Implementei o download somente em geoJson. Testes abrindo os desenhos no QGIS funcionam beleza!
tnixeu added a commit to tnixeu/shp-write that referenced this issue Jul 28, 2023
@sheindel
Copy link
Contributor

JSZip ahs been upgraded in the latest tagged version (v0.4.0). Will be released on npm soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants