mapbox / shp-write

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

Add option to zip files without folder #72

Closed dulldrums closed 10 months ago

dulldrums commented 5 years ago

This addresses issue #70

Problem

When zipping and downloading a shp file, jsZip creates a folder to put the files in. When the downloaded zip file is loaded into QGIS, it throws an error because it has a folder inside it. We want to have an option to zip the files without putting them in a folder.

Usage

Set folder:false in the options object that is passed into the zip function.

Example:
import { zip } from 'shp-write';

const geojson = {} // some valid geojson object

const options = {
  folder: false,
  types: {
    polylines: 'lines',
  }
}

const zipResults = zip(geojson, options);
dulldrums commented 4 years ago

I just updated this so the default behavior is a shallow zip, which is compatible with QGIS and ArcGIS. If options.folder is specified and a string, then this will create a zip file that unzips to a folder with the specified name.

baxter1707 commented 3 years ago

@dulldrums Do you think this will be merged into master and released in the near future? This would be very helpful to have.

dulldrums commented 3 years ago

@baxter1707 I doubt it, PRs haven't been merged in nearly four years. There are several forks that are being actively maintained

sheindel commented 10 months ago

Should be resolved thanks to https://github.com/mapbox/shp-write/pull/96 and https://github.com/mapbox/shp-write/pull/100 , will publish soon, thanks!!