You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于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 with sf without relying on tigris:
    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")
    
    This file includes all municipal boundaries and matching Census attributes (like population, FIPS codes) that align with the datasets you’re working with.
  • 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 the places() function with this state code to pull official municipal boundaries:
    library(tigris)
    nmi_municipalities <- places(state = "69", year = 2023, cb = TRUE)
    
    The cb = TRUE flag 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 use counties() (though it’s not ideal for NMI), try specifying the state code and cartographic boundary flag—sometimes tigris excludes territories by default:
    nmi_county_equiv <- counties(state = "69", cb = TRUE, year = 2023)
    
    Note: NMI’s "county" equivalents are its four municipalities, so the 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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:04:28