I am working with vue3 to load a zipped shp file from a sample dataset found in the repository, https://github.com/calvinmetcalf/shapefile-js/blob/gh-pages/files/counties5.zip
The shp library used is https://github.com/calvinmetcalf/shapefile-js. shpjs ‘s version is “^5.0.1”.
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 code runs 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)