UScensus2010包的areaPoly功能

时间:2015-11-09 20:39:41

标签: r

您好我使用以下R代码来获得块组级别的人口密度。

library(UScensus2010)
install.blkgrp(‘linux’)
library(UScensus2010blkgrp)

data(texas.blkgrp10)

a = texas.blkgrp10
b = cbind(geolink=a$fips,area = areaPoly(a),
      population = a$P0010001,
      pop_den=a$P0010001/areaPoly(a),
      num_house = a$H0010001,
      house_den=a$H0010001/areaPoly(a))

areaPoly(a)的测量单位是什么?

1 个答案:

答案 0 :(得分:1)

我无法直接与USCensus2010套餐发言(install.blkgrp('windows')似乎不起作用......),但在人口普查TIGER文件中,生成此数据的单位为 square米即可。您可以通过查看TIGER文件元数据来看到这一点,如下所示:

## BG=Block Group; FIPS 48 is Texas
url   <- "http://ftp2.census.gov/geo/tiger/TIGER2010/BG/2010/tl_2010_48_bg10.zip"
tf    <- tempfile()
td    <- tempdir()
download.file(url,tf, mode="wb")     # download shapefile archive of Texas BG Boundaries
unzip(tf, exdir=td)                  # unzip into directory td
library(XML)
# metadata is in *.shp.xml
doc   <- xmlTreeParse(paste(td,"tl_2010_48_bg10.shp.xml", sep="/"), useInternalNodes=TRUE)
doc["//attr[attrlabl='ALAND10']"]    # metadata for ALAND10 field in attributes table
# [[1]]
# <attr>
#   <attrlabl>ALAND10</attrlabl>
#   <attrdef>2010 Census land area (square meters)</attrdef>
#   <attrdefs>U.S. Census Bureau</attrdefs>
#   <attrdomv>
#     <edom>
#       <edomv>0 to 9,999,999,999,999</edomv>
#       <edomvd>Blank</edomvd>
#       <edomvds>U.S. Census Bureau</edomvds>
#     </edom>
#   </attrdomv>
# </attr>