calvinmetcalf / shapefile-js

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

Projected small demo doesn't work: Invalid URL #180

Open Richard-Walter opened 2 years ago

Richard-Walter commented 2 years ago

Clicking on your Projected small demo I get an error in the chrome/edge browser console:

TypeError: Failed to construct 'URL': Invalid URL at checkSuffix (shp.js:14498:15) at Function.shp.getShapefile (shp.js:14505:7) at shp (shp.js:14399:14) at proj-small.html:38:3

Same isse happens with some of your other demos. Any idea what is causing this?

benderlidze commented 1 year ago

try something like this

   fetch("shp.zip")
                .then(text => text.arrayBuffer())
                .then((myshape) => shp(myshape))
                .then((data) => {

//your data 

                }).catch(e => console.log('error', e));