News for hackers. Stuff that matters.
Re:The New York Times Releases Its Dataset of U.S. Confirmed... by pj_mukh on Friday March 27, 2020 @02:50PM (#22705627)
Noob Question: Anyone know an easy way to convert FIPS data (that this nytimes dataset uses) to Postal code?
Re:The New York Times Releases Its Dataset of U.S. Confirmed... by danso on Friday March 27, 2020 @04:38PM (#22706646)
It's a good question, and unfortunately, the answer is that zipcode does not map well to other kinds of geographical regions, or to day-to-day-reality for that matter.

To directly answer your question, it is not uncommon for zipcodes to span county boundaries. And there are even a handful that span more than one state: https://gis.stackexchange.com/questions/53918/determining-wh...

To the broader question of why zip codes can be lacking for geospatial analysis, here's a real-world situation:

https://theconversation.com/how-zip-codes-nearly-masked-the-...

Here's a more broader essay from CartoDB: https://carto.com/blog/zip-codes-spatial-analysis/

Re:The New York Times Releases Its Dataset of U.S. Confirmed... by pj_mukh on Friday March 27, 2020 @06:05PM (#22707341)
Interestinggg. So, as mentioned by another user, I'm better off mapping Lat/Lon to FIPS. Found a census endpoint that does just that[1]!

Now for an address, I can geocode it up.

https://geo.fcc.gov/api/census/

Re:The New York Times Releases Its Dataset of U.S. Confirmed... by danso on Friday March 27, 2020 @06:19PM (#22707432)
You can do better than geocoding: use one of the county-level shapefiles from the TopoJSON project: https://github.com/topojson/us-atlas

At the very least, if you do just need point-level info, you can get the centroids of the county shapes.

Re:The New York Times Releases Its Dataset of U.S. Confirmed... by jake-low on Friday March 27, 2020 @03:02PM (#22705768)
I don't think it's generally possible. The FIPS code just identifies the county (the first two digits are the state, e.g. 06 for California) and the final three identify a county in that state. So technically that column is redundant with the "county" and "state" columns; I suspect they've included it to make joining this dataset to other data that might use different name-formatting of counties/states easier.

ZIP/postal codes are generally smaller (in the county I live in there are almost a hundred ZIP codes). I'm not sure they're even guaranteed to be entirely within one county either. We tend to think of ZIP codes as boundaries but they're actually delivery routes (which if you squint can be converted into boundaries by joining the properties that those routes serve together).

You might be interested in this article: https://carto.com/blog/zip-codes-spatial-analysis/

Re:The New York Times Releases Its Dataset of U.S. Confirmed... by llimllib on Friday March 27, 2020 @03:11PM (#22705850)
zip codes span counties and also states. A few are actually in three different states.

(I have suffered at the hands of zip-codes-as-geographic-entities)

Re:The New York Times Releases Its Dataset of U.S. Confirmed... by pj_mukh on Friday March 27, 2020 @04:02PM (#22706275)
Right, so a simple mapping I'd want is given a Zip Code, what is the corresponding FIPS Code.
Re:The New York Times Releases Its Dataset of U.S. Confirmed... by tomrod on Friday March 27, 2020 @05:34PM (#22707113)
Pick a lat/long, and you can map between. Or find the centroid of the zip code and map accordingly. Or you might consider unions between the geometry objects. Qgis3 has a lot of great packages for this.
Re:The New York Times Releases Its Dataset of U.S. Confirmed... by throwawayjava on Friday March 27, 2020 @03:02PM (#22705767)
Re:The New York Times Releases Its Dataset of U.S. Confirmed... by xxpor on Friday March 27, 2020 @03:03PM (#22705779)
FIPS codes are only specific to the county. It'd be a one-to-many mapping (or many-to-one, depending on if it was a rural area, I guess? I'm not sure if ZIP codes ever cross county lines.)
Re:The New York Times Releases Its Dataset of U.S. Confirmed... by fragmede on Friday March 27, 2020 @09:38PM (#22708487)
it's the hardest of them all, many-to-many
Re:The New York Times Releases Its Dataset of U.S. Confirmed... by tomrod on Friday March 27, 2020 @05:32PM (#22707100)
It's nontrivial.

Check out ZCTA crosswalk in US census.