nycehs / nyccas-vis-demo

0 stars 0 forks source link

rasters for pollutant maps #1

Closed mmontesanonyc closed 1 year ago

mmontesanonyc commented 1 year ago

@cgettings @chuskey79 - in pollutant-maps-over-time I created buttons and a year slider, plus javascript that gets the values for the selected pollutant and year. if you open the console you can see that on clicking either set of controls, it logs to the console the variable polYear which is pollutant x year:

image

we can use this to tell the map which raster file to load (possibly via a json associating pollutant x year combo with a specific raster URL? or maybe we name them with a structure we can produce via the javascript).

@chuskey79 can you add a raster for black carbon 2022 so I can build the initial map?

mmontesanonyc commented 1 year ago

@cgettings - @chuskey79 asked me if he should provide the raster files, or geotiff. what do you recommend for using with leaflet?

cgettings commented 1 year ago

Probably both, and then we can test which one works better. But I'm inclined to say the GeoTIFF.

chuskey79 commented 1 year ago

OK. I created two folders (Geotiff and Raster) in a new folder called RasterFiles with each.

From: Chris Gettings @.> Sent: Monday, November 21, 2022 10:39 AM To: nycehs/nyccas-vis-demo @.> Cc: Christopher Huskey @.>; Mention @.> Subject: [EXTERNAL] Re: [nycehs/nyccas-vis-demo] rasters for pollutant maps (Issue #1)

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. Forward suspect email to @.**@.> as an attachment (Click the More button, then forward as attachment).

Probably both, and then we can test which one works better. But I'm inclined to say the GeoTIFF.

— Reply to this email directly, view it on GitHubhttps://github.com/nycehs/nyccas-vis-demo/issues/1#issuecomment-1322252332, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKDD3LDQDVE5BRSOIGV4RR3WJOJSRANCNFSM6AAAAAASFKEMDU. You are receiving this because you were mentioned.Message ID: @.***>

Sent from the New York City Department of Health & Mental Hygiene. This email and any files transmitted with it may contain confidential information and are intended solely for the use of the individual or entity to whom they are addressed. This footnote also confirms that this email message has been swept for the presence of computer viruses.

chuskey79 commented 1 year ago

We don't have BC rasters, yet. I uploaded two NO rasters from a couple years back, since I didn't have to create new files.

mmontesanonyc commented 1 year ago

Sounds good, no prob - I just want to get something in there.

mmontesanonyc commented 1 year ago

hey @cgettings, I poked around with using georaster for leaflet but there's something about how it works that i don't quite understand.

if i use their load file example and load in one of @chuskey79's geotiffs, it displays just fine. So the file is good.

But when I followed georaster for leaflet's instructions to set it up in a local repo, and the page script that i'm writing throws an error around using require. I think it has to do with something that I don't quite understand about Node.js and how a project needs to be structured - pretty sure i need a separate js file? But I also forked the georaster-for-leaflet example and dropped in the URL for our geotiff and got errors. Anyway, would love to put our heads together next week - and wanted to type this up to remember what was up. Some potentially helpful stuff here that I'll pick at if I have time.

cgettings commented 1 year ago

Yeah, you can't use require unless you're building a Node module. So we need to use the usual html script src tag to load anything.

cgettings commented 1 year ago

This example might work.

mmontesanonyc commented 1 year ago

I also looked into this a bit, might be a little bit simpler? Will go deeper next week.

mmontesanonyc commented 1 year ago

basics are in place but it's throwing errors trying to load the geotiff.

the same file loads fine from the package's "load file" example, but when I modify their load-cog-from-script, i get errors trying to fetch the geotiff.

@cgettings do you have bandwidth to look at this? i'm banging my head against one wall after another.

cgettings commented 1 year ago

I'll try to take a look

mmontesanonyc commented 1 year ago

Thanks. No worries if you don't have the bandwidth but maybe it's easier to dig into small projects than big ones this week.

cgettings commented 1 year ago

What are the errors specifically?

mmontesanonyc commented 1 year ago

Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'WorkerGlobalScope': Failed to parse URL from RasterFiles/Geotiff/noAA12final.tif at ie.blockSize [as retrievalFunction] at ie.requestData at ie.fetch at async xe.fromSource

cgettings commented 1 year ago

COG is a cloud optimized geotiff, which I don’t think our files are (yet). I don’t think that would throw a URL parse error, but it’s maybe worth looking into.

Any other fetch call differences?

mmontesanonyc commented 1 year ago

ah! ok. didn't realize that about COG. So, i grabbed a different example as a starting point, and now i've got a functional thing working. thanks!

mmontesanonyc commented 1 year ago

@chuskey79, I propose the following naming conventions:

For the last 3 years:

For the all years archive:

And, per conversation, the "pollutants over time" part of the map will show the last 3 (?) years, scaled to mins and maxes within those years - and we can link to an "all years" archive that have a scale consistent across all years, so people can see the whole progress.

chuskey79 commented 1 year ago

Put these files in github?

mmontesanonyc commented 1 year ago

Yup! You can plop 'em right in here.

chuskey79 commented 1 year ago

I've started to put them here: https://github.com/nycehs/nyccas-vis-demo/tree/main/RasterFiles/AllYears

mmontesanonyc commented 1 year ago

@chuskey79, i'm trying to start fiddling with these, but when i try to map them, the console throws an error:

image

Is there something about these that differ from noAA12final.tif (which was functional)?

chuskey79 commented 1 year ago

I think Sarah had exported the noAA12final.tif from her code, whereas I exported these from the raster files in arcgis. I wouldn't think that would cause an issue, but who knows...

mmontesanonyc commented 1 year ago

OK - if you could look into it that would be great! Also FYI I moved the rasters to a single location in /raster

chuskey79 commented 1 year ago

It will be difficult to export the older files from sarah's code. I'll try to reexport and see what happens.

chuskey79 commented 1 year ago

I changed the resolution to 200 dpi. I assume that wouldn't cause the issue, would it?

mmontesanonyc commented 1 year ago

I don't know. @cgettings might have insight here. pollutant-maps-over-time is throwing errors trying to map the geotifs, though an earlier file mapped just fine.

chuskey79 commented 1 year ago

Looks like arcgis didn't write the GEO part of the GeoTiff because that would require a special license to do one of the basic functions of a GIS software product.

chuskey79 commented 1 year ago

I'll have some tomorrow morning to test with before I redo the whole lot.

mmontesanonyc commented 1 year ago

Feel free to just do one - I can test and let you know if it works - before running off the rest.

chuskey79 commented 1 year ago

Try no2009.tif in the raster directory.

mmontesanonyc commented 1 year ago

success! (ignore the buttons - that's no2009.tif). image

chuskey79 commented 1 year ago

ok. I'll start republishing in the morning. ArcGIS doesn't like dashes in file names, so we'll need to change the file naming convention slightly.

mmontesanonyc commented 1 year ago

Sounds good. We can just remove dashes from the convention we currently have in /raster. I deleted what was in there before. If you could put them all there, in the same folder, that'd be ideal.

mmontesanonyc commented 1 year ago

A few that don't work:

chuskey79 commented 1 year ago

I think I know what the issue is. I'll republish today.

chuskey79 commented 1 year ago

Hopefully, these work now.

When you have a chance, can you mock something up so that I can see how the rasters look? Normally I need to equalize the visable range on these and I'm wondering how that's going to work.

mmontesanonyc commented 1 year ago

yup, serve up pollution-maps-over-time.html and you should be able to check it all out.

mmontesanonyc commented 1 year ago

DECISION:

Down the line: we'll do dynamic scaling & color based on raster values. (eg...)

mmontesanonyc commented 1 year ago

OK, pollutant-trend-images.html is working. Missing SO2 from 2017 to 2020, however. (And, I think we're waiting on 2021 data for everything.)

pollutant-maps is working, but it's set to show 2019. The 2021 files aren't working. Will troubleshoot.

chuskey79 commented 1 year ago

I forgot to export the 2021 pngs. i'll do that in the morning.

I'm not sure I exported the geotiffs from arcmap pro, so that may be the issue. I'll reexport.

chuskey79 commented 1 year ago

I uploaded the revised files. let me know if there are issues.

mmontesanonyc commented 1 year ago

For some reason, the 2021 rasters aren't working. Most of the previous years (with a few exceptions) are working fine. But the leaflet map isn't displaying the 2021 georasters. It throws an error about rendering the tiles. Are you exporting them the same way?

chuskey79 commented 1 year ago

ugh

chuskey79 commented 1 year ago

Try again....

chuskey79 commented 1 year ago

We normally have a text element with the maps that describes the data for each pollutant.

Is is going to be possible to add this to the viz?

chuskey79 commented 1 year ago

I uploaded a new geotiff file (no22021.tiff). I think it should keep the color rendering. Can you check it out and let me know? If so, I'll do the others...