calvinmetcalf / shapefile-js

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

Problem when downloading shapefile .zip from Azure Blob Storage with SAS-token #174

Closed pimvd closed 2 years ago

pimvd commented 2 years ago

Hi,

I've a very strange problem. We used to download a shapefile from our local server. But we are now moved to Azure Blob Storage and it's not working anymore. Looks like shpjs is requesting for files inside the zip, instead of the .zip itself.

So we used to download a file from /shapefile.zip. Was working perfect.

Now we are requesting a file from Azure Blob Storage. Via this code: shp(shapefile.url).then(geojson => L.geoJSON(geojson))

image

After the ? is the SAS-token for Azure. And after this shpjs is adding, for example, .shp and .prj. It's not trying to download the .zip at all.

Is there someone who can help?

Edit:

Is it a bug since the url is not ending on .zip but it's ending on the SAS token? https://github.com/calvinmetcalf/shapefile-js/blob/566e2105d33d5a2e5f7409d71dfb95da39856d29/lib/index.js#L153 image

calvinmetcalf commented 2 years ago

yeah i need to do something that correctly handles query params

calvinmetcalf commented 2 years ago

wait I forgot I already added something to fix the query params issue, the check suffix function should correctly handle the fact that you have a ?sv=whatever I just pushed up a new test to confirm and it should work, what version of this library are you using, and what is your environment, (node, browser?)

pimvd commented 2 years ago

Hi Calvin.

Thanks for your quick reply. It was my fault. I was still on version 3.6.3. Just updated to version 4.0.2 and it's fixed.

Thanks for the awesome package.

Pim