calvinmetcalf / leaflet.shapefile

Shapefile in Leaflet

Home Page:http://calvinmetcalf.github.io/leaflet.shapefile/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

file.zip automatically starts downloading.

abdulrehmanch112 opened this issue · comments

I want to prevent it from downloading...

Can you be a little more specific?

and this problem preventing shape file to show on map.

that part I got , what action did you do that led to this behavior.

i ve stopped idm to moniter my site "Donot Download from this Link." but its not proper solution

So you visit your site that's loading a shape.zip file into leaflet, and instead of loading it into the map, the browser tries to download it to your computer?

Yes, I have the same issue, instead of loading it into map the browser tries to download it to my computer

is the webserver sending it as an attachment ?

Yes

I'm not sure if there is anything this library can do about the browser behavior like that

Thanks a lot. I am trying to show a large parcel data in a shapefile format on my map. Small size parcel data works fine using the shapefile plugin but it responds slowly and often takes a long time to draw or don't draw at all.Please Do you have any suggestions as to the best way to display the data on my map? I have tried GeoJson but it also responded slowly.

the more data you have the more work it is for the browser to render it, you could look into something like carto.com or mapbox which are services to help display larger data sets or you could try to cut tiles

closing as we solved the issue of the files downloading

@calvinmetcalf I'm also facing this issue. I'm using leaflet.shapefile to display a shapefile in my map. The shapefile just downloads by default instead of displaying in the map.

I'm adding the shapefile as below

var shpfile = new L.Shapefile('path_to_zip_file/file.zip'); 
shpfile.addTo(map);

Isnt't it the right way to add the shapefile?

it's not a clientside issue @lalprakash the issue is that the server is setting a heading that tells the client 'hey you should download this thing' which is causing it to download automatically

@calvinmetcalf Thank you for the response. I clearly understand what you mean. But I just cant figure out where in my code or in my server has I written "hey you should download this thing". If possible please suggest me a way so that I can change "hey you should download this thing" to "hey you should NOT download this thing".

@calvinmetcalf is there any suggestion from your side that has to be done in my server so that the issue is solved ? I'm really glad and thankful to you for such a speedy response.

you should check the headers that the server is sending, the main this is just that the browser is downloading it it before it gets to this lib