【发布时间】:2017-07-18 19:26:02
【问题描述】:
我正在尝试使用 R 分析加油站点的空间密度。我需要在加油站周围创建一个缓冲区(圆圈)并计算缓冲区内的加油站数量。然后,我需要调整缓冲区距离,看看什么是合理的缓冲区才能看到有趣的东西。这些是我正在使用的文件:https://dl.dropboxusercontent.com/u/45095175/sbc_gas.shp; https://dl.dropboxusercontent.com/u/45095175/sbc_gas.shx; https://dl.dropboxusercontent.com/u/45095175/sbc_gas.dbf
# Install packages
x <- c("ggmap", "rgdal", "rgeos", "maptools", "ks")
lapply(x, library, character.only = TRUE)
all <- readShapePoints("sbc_gas.shp")
all.df <- as(all, "data.frame")
locs <- subset(all.df, select = c("OBJECTID", "Latitude", "Longitude"))
head(locs) # a simple data frame with coordinates
coordinates(locs) <- c("Longitude", "Latitude") # set spatial coordinates
plot(locs)
非常感谢任何帮助!
【问题讨论】: