I'm trying to use Shpjs package for import Shape file on leaflet map based on the shpjs doc : shpjs
Here is my code :
const [geoData, setGeoData] = useState(null); //state
//onChange function
const onChangeFile = ({ target }) => {
var reader = new FileReader();
var file = target.files[0];
reader.readAsArrayBuffer(file);
reader.onload = function (buffer) {
setGeoData(buffer.target.result);
};
};
and after that i use shpjs package like this :
const geoJson = await shp(geoData)
after import shp.zip i get this error :
How can I fix this?