如何绘制shapefile并提取lat/lng coords,以便在Google Maps上绘制多边形?
http://www2.census.gov/cgi-bin/shapefiles/national-files
我在这里问这个问题:
http://groups.google.com/group/Google-Maps-API/browse_thread/thread/18763b4b0cb996c7
他们告诉我该怎么做,但不是如何做到这一点= P.
谢谢!
我被要求根据美国的州和城市生成一些人口统计报告(犯罪率,出生/死亡等).我拥有所有人口统计数据(由我们的客户提供),但似乎找不到任何有美国各州及其城市边界(读取:LAT/LONG)的地方.
我们的数据是Lat/Long数据点(例如犯罪,出生等),我们希望使用Sql server获取一些映射报告和数据(我们使用MS Sql 2008,但这不应该影响这个题).
所以......有人能指引我去哪里有州和城市边界来源吗?我知道我们的政府在美国人口普查局免费提供所有这些信息,但我似乎无法理解它在哪里以及如何消化这些信息.
我假设这个信息将采用lat/long多边形(例如shapefile等)的形式,然后我可以将其导入到数据库中并将其导出.
有人可以帮忙吗?
我正在尝试为各种地理区域(即县/邮政编码)映射多边形.根据我在这个博客上发现的内容,我可以轻松地为各县实现这一目标.
library(rgdal)
library(rgeos)
library(leaflet)
url<-"http://www2.census.gov/geo/tiger/TIGER2010DP1/County_2010Census_DP1.zip"
downloaddir<-getwd()
destname<-"tiger_county.zip"
download.file(url, destname)
unzip(destname, exdir=downloaddir, junkpaths=TRUE)
filename<-list.files(downloaddir, pattern=".shp", full.names=FALSE)
filename<-gsub(".shp", "", filename)
# ----- Read in shapefile (NAD83 coordinate system)
# ----- this is a fairly big shapefile and takes 1 minute to read
dat<-readOGR(downloaddir, "County_2010Census_DP1")
# ----- Create a subset of New York counties
subdat<-dat[substring(dat$GEOID10, 1, 2) == "36",]
# ----- Transform to EPSG 4326 - WGS84 (required)
subdat<-spTransform(subdat, CRS("+init=epsg:4326"))
# ----- save the data slot
subdat_data<-subdat@data[,c("GEOID10", "ALAND10")]
# ----- simplification …Run Code Online (Sandbox Code Playgroud)