publiclab / leaflet-environmental-layers

Collection of different environmental map layers in an easy to use Leaflet library, similar to https://github.com/leaflet-extras/leaflet-providers#leaflet-providers
https://publiclab.github.io/leaflet-environmental-layers/example/
GNU General Public License v3.0
99 stars 77 forks source link

bug: ToxicReleaseLayer does not stop loading at times #146

Open rkpattnaik780 opened 5 years ago

rkpattnaik780 commented 5 years ago

We are preparing to participate in Google Code-in, and have reserved this issue for participants in GCI - but we'd love to have your help with another one! Please check out https://code.publiclab.org to see more.

Issue

The ToxicReleaseLayer doesn't stop loading at certain coordinates. For example in [43.00,-9.87] url : leaflet-environmental-layers/example/index.html#3/43.00/-9.87/BL2-ToxicR). A possible explanation can be that the get request isn't handled properly.

For coordinates [43.00,-9.87], a get request is being made with url : https://iaspub.epa.gov/enviro/efservice/tri_facility/pref_latitude/BEGINNING/43/PREF_LONGITUDE/BEGINNING/9/rows/0:300/JSON which gives the following error message :

image

jensiner commented 5 years ago

As a first-time contributor I am interested in working on this, can I do it?

rkpattnaik780 commented 5 years ago

@jensiner sure, go ahead. Thanks!

jensiner commented 5 years ago

I am confused-- when I try to look up the link: https://publiclab.github.io/leaflet-environmental-layers/example/index.html#3/43.00/-9.87/BL2-ToxicR it does not show an errors. It is the URL for the coordinates 43.00 and -9.87 that is causing the error, right?

rkpattnaik780 commented 5 years ago

I guess the latest commits haven't been deployed, check it locally, the loader doesn't stop. The error is from the API end, at coordinates 43.00,-9.87 a call is made to https://iaspub.epa.gov/enviro/efservice/tri_facility/pref_latitude/BEGINNING/43/PREF_LONGITUDE/BEGINNING/9/rows/0:300/JSON. This is where you get the error message.

jensiner commented 5 years ago

image if when I view the program locally it shows up like this (spotty) as opposed to the entire map, is that a problem with how I am looking at the program on my machine (i.e. I don't have something installed) or does it have to do with the error we are dealing with?

rkpattnaik780 commented 5 years ago

image if when I view the program locally it shows up like this (spotty) as opposed to the entire map, is that a problem with how I am looking at the program on my machine (i.e. I don't have something installed) or does it have to do with the error we are dealing with?

It must be due to some uninstalled dependencies. Try installing the dependencies again. Thanks :)

jensiner commented 5 years ago

Does it make sense to then program a badly handled get request as an error and tell stop the loading?

jensiner commented 5 years ago

The error happens when a latitude and longitude gets converted to an integer and then it just continues loading because it's a bad URL. I tried in toxicReleaseLayer changing the parseInt that is currently written around the selected longitude and latitude to parseFloat to preserve the decimal instead of converting to an integer when the function links to this https://iaspub.epa.gov/enviro/efservice/tri_facility/pref_latitude/BEGINNING/43/PREF_LONGITUDE/BEGINNING/9/rows/0:300/JSON but it did not work and I wonder if it's possible to somehow check if it is not a valid URL and tell the script to understand that as an exception. Does that make sense?

rkpattnaik780 commented 5 years ago

Does it make sense to then program a badly handled get request as an error and tell stop the loading?

I think this will work.

ananyaarun commented 4 years ago

This issue in LEL is reserved for GCI students. Thanks !!

SidharthBansal commented 4 years ago

Uploaded to GCI dashboard.

jywarren commented 4 years ago

Linked to #46 and #43 as well!

VladimirMikulic commented 4 years ago

Error not reproducible. It works fine in both, production and development.

jywarren commented 4 years ago

Can you try doing it a lot, like zooming out, dragging, etc? I think it might be load-based; like their server can't handle it sometimes. It'd be nice to know if this is the issue? Thanks!

sagarpreet-chadha commented 4 years ago

In LEL, in each layer we stop the spinner when we have 200 status code in response only. I think we should stop the spinner when we get the response irrespective of response status code.

jywarren commented 4 years ago

Ah I like this idea. We could develop some better per-layer error handling!

On Mon, Dec 16, 2019, 1:00 PM Sagarpreet Chadha notifications@github.com wrote:

In LEL, in each layer we stop the spinner when we have 200 status code in response only. I think we should stop the spinner when we get the response irrespective of response status code.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/publiclab/leaflet-environmental-layers/issues/146?email_source=notifications&email_token=AAAF6J3X72TOSZIQYIGN2PLQY664RA5CNFSM4G6SK4SKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG7RYKI#issuecomment-566172713, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAF6JZB3KUTCP4TLKLDKGDQY664RANCNFSM4G6SK4SA .