azavea / pfb-network-connectivity

PFB Bicycle Network Connectivity
Other
40 stars 10 forks source link

Only get state OSM extracts for US states #916

Closed KlaasH closed 1 year ago

KlaasH commented 1 year ago

Overview

The OSM downloader was treating any state abbreviation as a US state and trying to download a state extract for it. But now there are non-US neighborhoods with states that are using this script, so it needed to have that logic protected by a "only in the US" check.

Geofabrik has state-level extracts for several other countries, but knowing which countries it has and which it doesn't, and getting the names to match up exactly right, would be fiddly and error-prone, so we'll just stick with national extracts.

Resolves #915

Notes

I noticed when I went to update the changelog that I had missed some steps when I updated it for the last release, so I fixed that up here.

Testing Instructions

I tested it by adding raise Exception("Time to download OSM extract from " + osm_extract_url) to the download_from_geofabrik function right before it actually tries to download from Geofabrik. That way I could kick off several different analysis runs (in the US and elsewhere, with and without the state field set) and not have to wait for it to actually try to download the extract or finish the analysis. I just verified that all the URLs it said it was going to grab were correct.

Note that you have to make sure the file it needs isn't in the osm-data-cache on your S3 bucket, or the script will download it from there and not try to get it from Geofabrik.

Checklist