Last active
April 16, 2025 17:42
-
-
Save benjamin-chan/9bb48d68bdc4af67e263ba9a43772257 to your computer and use it in GitHub Desktop.
HUD population weighted zip code centroids
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [Website](https://hudgis-hud.opendata.arcgis.com/datasets/zip-code-population-weighted-centroids-1/about) | |
# [API](https://hudgis-hud.opendata.arcgis.com/datasets/zip-code-population-weighted-centroids-1/api) | |
library(magrittr) | |
library(dplyr) | |
library(jsonlite) | |
# All zip codes, all columns | |
url <- "https://services.arcgis.com/VTyQ9soqVukalItT/arcgis/rest/services/ZIP_Code_Population_Weighted_Centroids/FeatureServer/0/query?where=1%3D1&outFields=*&outSR=4326&f=json" | |
centroids <- fromJSON(url)$features | |
# Oregon zip codes, essential columns only | |
url <- "https://services.arcgis.com/VTyQ9soqVukalItT/arcgis/rest/services/ZIP_Code_Population_Weighted_Centroids/FeatureServer/0/query?where=USPS_ZIP_PREF_STATE='OR'&outFields=STD_ZIP5,USPS_ZIP_PREF_CITY,LAT,LON&outSR=4326&f=json" | |
centroids <- fromJSON(url)$features$attributes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment