在R中NAD83州平面多边形上叠加十进制坐标(新泽西州)

在R中NAD83州平面多边形上叠加十进制坐标(新泽西州),r,R,我试图在多段线形状文件上用点(新泽西州的十进制坐标)绘制一个带有投影NAD 83状态平面(英尺)(新泽西州)的图。我怎么做?到目前为止,我可以分别绘制点和形状文件,但无法覆盖 使用以下代码打印形状文件: orgListLayers("Counties.shp") # Shows the available layers for the shpaefile "Counties: shape=readOGR("Counties.shp", layer="Counties") # Load the

我试图在多段线形状文件上用点(新泽西州的十进制坐标)绘制一个带有投影NAD 83状态平面(英尺)(新泽西州)的图。我怎么做?到目前为止,我可以分别绘制点和形状文件,但无法覆盖

使用以下代码打印形状文件:

orgListLayers("Counties.shp") # Shows the available layers for the shpaefile "Counties:
shape=readOGR("Counties.shp", layer="Counties")  # Load the layer of the shapefile
plot(shape) # Plots the shapefile
在ArcGIS中将点转换为状态平面后,使用以下代码绘制点(矢量为lat1,long1):

dpts  <- as.data.frame(cbind(long1,lat1))
plot(dpts2)

dpts您没有提供任何数据,因此这可能是部分答案

使用
ggplot
软件包可以轻松创建分层地图。这张新泽西大学的地图是用下面的代码片段创建的。它演示了在同一地图上绘制点和边界,并根据大学的数据(此处为入学数据)调整点的大小

library(ggplot2)
library(rgdal)

setwd("<directory containing your data and maps")
states   <- readOGR(dsn=".",layer="tl_2013_us_state")
nj.map   <- states[states$NAME=="New Jersey",]    
univ.map <- readOGR(dsn=".",layer="NJ_College_Univ_NAD83njsp")

nj.df    <- fortify(nj.map)
univ.df <-  univ.map@data
univ.df$ENROLL <- as.numeric(as.character(univ.df$ENROLL))
# create the layers
ggMap <- ggplot(nj.df)
ggMap <- ggMap + geom_path(aes(x=long,y=lat, group=group))  # NJ boundary
ggMap <- ggMap + geom_point(data=univ.df,  aes(x=X, y=Y, size=ENROLL),color="red", alpha=0.7)
ggMap <- ggMap + coord_fixed()
ggMap <- ggMap + scale_size_continuous(breaks=c(5000,10000,15000,20000,25000,30000), range=c(0,10))
# render the map
ggMap
The call to ggplot(...) defines the NJ map as the default dataset.
The call to geom_path(...) adds a layer to draw the NJ boundary.
The call to geom_point(...) adds a point layer locating the universities, with point size proportional to enrollment.
The call to coord_fixed(...) ensures that the map will not be distorted.
The call to scale_size_continuous(...) establishes breaks for the legend labels.