fetch_read_zipped_shapefile = async (targetUrl) => {
const proxyUrl = "https://api.allorigins.win/get?url=";
const response = await fetch(proxyUrl + encodeURIComponent(targetUrl));
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
const base64Data = data.contents.split(",")[1];
const arrayBuffer = await Uint8Array.from(atob(base64Data), (c) =>
c.charCodeAt(0)
).buffer;
const shapeFileData = await shp(arrayBuffer);
return shapeFileData;
}