calvinmetcalf / shapefile-js

Convert a Shapefile to GeoJSON. Not many caveats.
http://calvinmetcalf.github.io/shapefile-js/
714 stars 228 forks source link

Error: no layers founds when parsing zipped shp file from the samples #213

Open helxsz opened 1 week ago

helxsz commented 1 week ago

currently using vue3 with shpjs, the version is "^5.0.1". i tried to use a public dataset found in the repository, https://github.com/calvinmetcalf/shapefile-js/blob/gh-pages/files/counties5.zip.

export async function loadGeojson(file: File): Promise<FeatureCollection<any>> {
    const format = file.name.split('.').at(-1).toLowerCase();
    let geojson: FeatureCollection<any>;
    switch (format) {
      case 'zip': {
        const parsed = await shp(await file.raw.arrayBuffer());
        geojson = parsed;
        break;
      }

but the codes running with an error

shpjs.js?v=9c11b5bb:6989 Uncaught (in promise) Error: no layers founds
    at parseZip (shpjs.js?v=9c11b5bb:6989:11)
    at async Module.loadGeojson (shp.ts:55:24)
    at async Proxy.uploadFile (upload.vue:146:13)

any idea how to work it out?