关于tigris R Maps关岛及马里亚纳群岛地图的技术问询
Solutions for Guam & Northern Mariana Islands Shapefile Issues with tigris
Hey there, let’s break down practical, official solutions for both your shapefile challenges:
1. Guam Municipal Polygon Alternatives (Since tigris Doesn’t Surface This Data)
Even though tigris doesn’t pull Guam’s municipal boundaries directly, there are reliable, Census-aligned sources you can use instead:
- US Census Bureau TIGER/Line Shapefiles (Direct Access)
Guam’s municipal units map directly to Census "Places" (the Bureau’s term for incorporated cities/towns). You can pull this data directly withsfwithout relying on tigris:
This file includes all municipal boundaries and matching Census attributes (like population, FIPS codes) that align with the datasets you’re working with.library(sf) # Guam's FIPS code is 66; 2023 is the latest TIGER year at time of writing guam_municipalities <- st_read("https://www2.census.gov/geo/tiger/TIGER2023/PLACE/tl_2023_66_place.zip") - ACS Cartographic Boundary Files
If you need simplified boundaries (better for mapping), the Census Bureau’s ACS boundary bundles include Guam’s municipal places. Look for the "Place" layer for Guam in the ACS 5-year estimate boundary files. - Guam Department of Land Management (DLM)
For hyper-local, official municipal boundaries (often more detailed than Census data), check Guam’s DLM geospatial portal. They maintain authoritative boundary data for the territory’s municipalities.
2. Official Northern Mariana Islands Shapefiles (Replacing Your tigris Workaround)
The issue with tigris::counties() for NMI is that NMI doesn’t use a county-level administrative structure—its primary local governments are municipalities, which map to Census "Places" instead. Here’s the proper way to get this data:
- Use tigris’
places()Function
NMI’s FIPS code is 69. Call theplaces()function with this state code to pull official municipal boundaries:
Thelibrary(tigris) nmi_municipalities <- places(state = "69", year = 2023, cb = TRUE)cb = TRUEflag gives you simplified cartographic boundaries (great for mapping), while omitting it gives you full-resolution TIGER/Line boundaries. - Direct TIGER/Line Download
If you prefer bypassing tigris entirely, grab the NMI Place shapefile directly from the Census Bureau:library(sf) nmi_municipalities <- st_read("https://www2.census.gov/geo/tiger/TIGER2023/PLACE/tl_2023_69_place.zip") - Verify tigris Parameter Settings
If you must usecounties()(though it’s not ideal for NMI), try specifying the state code and cartographic boundary flag—sometimes tigris excludes territories by default:
Note: NMI’s "county" equivalents are its four municipalities, so thenmi_county_equiv <- counties(state = "69", cb = TRUE, year = 2023)places()function is still the more accurate match for your needs.
Hope these official, supported methods help you ditch workarounds and get the precise shapefiles you need!
内容的提问来源于stack exchange,提问作者RTS
相关产品推荐
相关产品推荐

