Download shapefiles based on FIPS codes of States, Counties, Cities/CDPs, Tracts, or Blockgroups
Source:R/shapes_from_fips.R
shapes_from_fips.Rd
Download shapefiles based on FIPS codes of States, Counties, Cities/CDPs, Tracts, or Blockgroups
Usage
shapes_from_fips(
fips,
myservice_blockgroup =
"https://services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/USA_Boundaries_2022/FeatureServer/5/query",
myservice_tract =
"https://services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/USA_Boundaries_2022/FeatureServer/4/query",
myservice_place = "tiger",
myservice_county = "cartographic"
)
Arguments
- fips
vector of one or more Census FIPS codes such as from
name2fips()
- myservice_blockgroup
URL of feature service to get shapes from, or "cartographic" or "tiger" to use approx or slow/accurate bounds from tidycensus and tigris packages.
- myservice_tract
URL of feature service to get shapes from, or "cartographic" or "tiger" to use approx or slow/accurate bounds from tidycensus and tigris packages.
- myservice_place
only "tiger" is implemented
- myservice_county
URL of feature service to get shapes from, or "cartographic" or "tiger" to use approx or slow/accurate bounds from tidycensus and tigris packages. Note State bounds are built into this package as data so do not need to be downloaded from a service.
Examples
# shp2 = shapes_from_fips("10001", "10005")
fipslist = list(
statefips = name2fips(c('DE', 'RI')),
countyfips = fips_counties_from_state_abbrev(c('DE')),
cityfips = name2fips(c('chelsea,MA', 'st. john the baptist parish, LA')),
tractfips = substr(blockgroupstats$bgfips[300:301], 1, 12),
bgfips = blockgroupstats$bgfips[300:301]
)
shp <- list()
# \donttest{
for (i in seq_along(fipslist)) {
shp[[i]] <- shapes_from_fips(fipslist[[i]])
print(shp[[i]])
# mapfast(shp[[i]])
}
# }