leaflet-environmental-layers icon indicating copy to clipboard operation
leaflet-environmental-layers copied to clipboard

bug: ToxicReleaseLayer does not stop loading at times

Open rkpattnaik780 opened this issue 5 years ago • 16 comments

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

rkpattnaik780 avatar Mar 14 '19 15:03 rkpattnaik780

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

jensiner avatar Mar 31 '19 13:03 jensiner

@jensiner sure, go ahead. Thanks!

rkpattnaik780 avatar Apr 01 '19 09:04 rkpattnaik780

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?

jensiner avatar Apr 01 '19 19:04 jensiner

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.

rkpattnaik780 avatar Apr 01 '19 19:04 rkpattnaik780

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?

jensiner avatar Apr 01 '19 19:04 jensiner

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 :)

rkpattnaik780 avatar Apr 01 '19 19:04 rkpattnaik780

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

jensiner avatar Apr 06 '19 20:04 jensiner

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?

jensiner avatar Apr 06 '19 21:04 jensiner

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.

rkpattnaik780 avatar Apr 07 '19 07:04 rkpattnaik780

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

ananyaarun avatar Nov 12 '19 12:11 ananyaarun

Uploaded to GCI dashboard.

SidharthBansal avatar Nov 15 '19 09:11 SidharthBansal

Linked to #46 and #43 as well!

jywarren avatar Dec 03 '19 15:12 jywarren

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

VladimirMikulic avatar Dec 15 '19 15:12 VladimirMikulic

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!

jywarren avatar Dec 16 '19 17:12 jywarren

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.

sagarpreet-chadha avatar Dec 16 '19 18:12 sagarpreet-chadha

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

On Mon, Dec 16, 2019, 1:00 PM Sagarpreet Chadha [email protected] 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 .

jywarren avatar Dec 16 '19 18:12 jywarren