合并ZCTA边界以根据R中的邮政编码获得用户定义的区域
我正试图制作一张由我的客户定义的销售区域地图,以显示每个区域的年销售额 我从美国人口普查局下载了ZCTA文件。我使用以下代码获取领土地图:合并ZCTA边界以根据R中的邮政编码获得用户定义的区域,r,subset,geospatial,polygons,R,Subset,Geospatial,Polygons,我正试图制作一张由我的客户定义的销售区域地图,以显示每个区域的年销售额 我从美国人口普查局下载了ZCTA文件。我使用以下代码获取领土地图: en`#reading shapefile oregon <- readOGR(dsn = ".", layer = "cb_2013_us_zcta510_500k") #alignment data from hive, this is the file that have zip codes corresponding to all the t
en`#reading shapefile
oregon <- readOGR(dsn = ".", layer = "cb_2013_us_zcta510_500k")
#alignment data from hive, this is the file that have zip codes corresponding to all the territories
Territory_Zip_dataunique_zip <- dataTier1
Territory_Zip_dataunique_zip$l_alignment.zipcode <- clean.zipcodes(Territory_Zip_dataunique_zip$l_alignment.zipcode)
terrData <- Territory_zip_data_unique_zip
#Get all the zip codes from my territory file
terrData1 <- data.frame(Territory_zip_data_master[,1])
names(terrData1) <- c("GEOID10")
#Subset ZCTA file to have only zips that are in my territory file
oregonSubset <- merge(oregon,terrData1, all.y = F, all.x = F)
#merge with territory file to get corresponsding territory ids
natnds <- merge(oregonSubset, terrData, by.x = "GEOID10", by.y = "l_alignment.zipcode", all.y = F, all.x = F)
#make territory ids as revised ids for polygondataframe
revised_id <- natnds$l_alignment.territoryid
#Redefine shapefile based on revised ids
unionPoly <- unionSpatialPolygons(oregonSubset,revised_id)
#Fortify the spacialpolygondataframe
unionPoly_fort <- fortify(unionPoly)
#Plot
p <- ggplot() +
geom_polygon(data = ds, aes(x = long, y = lat, group = group,
fill = id), color = "black", size = 0.25) +
theme(legend.position="none",
plot.background = element_rect(fill = "transparent",colour = NA),
panel.background =element_rect(fill = "transparent",colour = NA), # or theme_blank()
panel.grid.minor =element_blank(),
panel.grid.major =element_blank(),
axis.ticks = element_blank(),
axis.text = element_blank(),
axis.title = element_blank())
en`#读取shapefile
俄勒冈州首先,修复。2010年之前的边界,没有空白,可在
现在我来告诉你这些差距是什么意思。问题是,至少在一定程度上,一些美国土地不在已申报的ZCTA范围内。根据人口普查页面,“对于2010年的人口普查,大型水体和大型无人区没有ZCTA”(我无法链接,但你可以在谷歌上找到)。这在人口较少的地区尤其糟糕,但在大城市附近甚至有缺失的地区
例如,请参见芝加哥地区的这一探索:。缺失的区域显然是自然保护区(如米德温国家塔格拉斯公园和谷歌建议的位于其南部的布拉德伍德自然保护区),根据定义,该保护区不应该有长期人类居住。首先,修复。2010年之前的边界,没有空白,可在
现在我来告诉你这些差距是什么意思。问题是,至少在一定程度上,一些美国土地不在已申报的ZCTA范围内。根据人口普查页面,“对于2010年的人口普查,大型水体和大型无人区没有ZCTA”(我无法链接,但你可以在谷歌上找到)。这在人口较少的地区尤其糟糕,但在大城市附近甚至有缺失的地区
例如,请参见芝加哥地区的这一探索:。缺失的区域显然是自然保护区(如米德温国家塔格拉斯公园和谷歌建议的位于其南部的布拉德伍德自然保护区),根据定义,该保护区不应该有长期人类居住。我面临着类似的问题,但与2010年前ZCTA的联系已经消失。我在census dot gov上尝试过的任何ZCTA文件都会导致上述漏洞。你知道现在在哪里可以找到2010年前差距较小的ZCTA吗?我面临着一个类似的问题,但与2010年前ZCTA的联系已经消失了。我在census dot gov上尝试过的任何ZCTA文件都会导致上述漏洞。你知道现在在哪里可以找到2010年前的零差价零差价吗?