【发布时间】:2017-06-15 23:54:44
【问题描述】:
提前谢谢你
我正在尝试创建一个农场密度图,我有其中的坐标。我有农场长/纬度坐标,我已将其转换为空间数据并使用以下代码绘制在新西兰地图上;
# Read in New Zealand shape file
NZ <-readShapeLines("ESRI_Shapefile_2016_Digital_Boundaries_High_Def_Clipped/TA2016_HD_Clipped.shp")
# Change projection
proj4string(NZ)<-CRS("+proj=tmerc +lat_0=0.0 +lon_0=173.0 +k=0.9996 +x_0=1600000.0 +y_0=10000000.0 +datum=WGS84 +units=m")
# Plot map and point data
plot(NZ)
points(Farm_points)
有没有一种简单的方法可以将此点数据转换为密度数据并在地图上绘制?
我尝试使用 GISTools 包和以下代码计算每个多边形中的点数;
counts <- poly.counts(Farms_points, NZ)
但是我收到以下错误消息;
Error in identical(spgeom1@proj4string, spgeom2@proj4string) :
trying to get slot "proj4string" from an object of a basic class ("matrix") with no slots
欢迎提出建议……
谢谢
【问题讨论】:
-
你们能提供样本数据吗?
标签: r spatial density-plot