rharron / CovidVisualization

Code for visualizing Covid-19 data
GNU General Public License v3.0
0 stars 0 forks source link

Figure out encoding of the NYC svg map #5

Closed rharron closed 4 years ago

rharron commented 4 years ago

The file svg you can get from https://www1.nyc.gov/site/doh/covid/covid-19-data.page is all written in one line, so it's a mess to parse by looking at it. But once we figure it out, it shouldn't be so bad to edit it.

rharron commented 4 years ago

It looks like each ZTCA corresponds to a tag in the svg file that begins with "<path aria-label=". What follows that is some human-readable text about that ZTCA and then a whole bunch of number that I'm pretty sure are encoding the actual geometry of that ZCTA and near the end of the path tag is something like 'fill="rgb(238, 88, 158)"', which looks like it's encoding what colour to make that ZTCA. So that seems to explain it. I'll play around with this to see if I'm right.

Also, I've uploaded the June 12th version of the case rate map to this repo. I called it NYCmap06-12.svg.

rharron commented 4 years ago

For posterity's sake, I'll note that the human-readable test about the ZCTA contains a field called "ZIP Code" and sometimes that field contains two zip codes. In this case, you can find the data for that ZCTA listed under the first zip code (the second zip code is absent from the data files).

rharron commented 4 years ago

The recent commits have allowed our code to batch create svgs (of the covid count rate). I took the svg and used Imagemagick to create a gif. Here it is!

NYC_covid

There's definitely a widespread spike on April 26. Is it a mistake?

I still need to figure out how to make the colour legend match the colour map I use. That'll be for another day!

tjcombs commented 4 years ago

Very nice!

That spike seems related to the data quality issue in #4

rharron commented 4 years ago

Commit befc05126d307989f018b6ac801a6c5270224600 adds the ability to choose the colormap to use (by name) and updates the legend accordingly (still need to update the min and max values on the legend). Here's a gif for the colormap 'Spectral_r': NYC_covid_Spectral_r