【发布时间】:2018-03-19 01:59:56
【问题描述】:
我正在绘制德克萨斯州休斯顿炼油厂的位置。我用以下代码定义了研究区域。
P4S.latlon <- CRS("+proj=longlat +datum=WGS84 ")
county.lines <-readShapePoly("tl_2017_us_county/tl_2017_us_county.shp", verbose = T, proj4string = P4S.latlon)
harris <- subset(county.lines, county.lines$GEOID == 48201)
brazoria <- subset(county.lines, county.lines$GEOID == 48039)
galveston <- subset(county.lines, county.lines$GEOID == 48167)
chambers <- subset(county.lines, county.lines$GEOID == 48071)
liberty <- subset(county.lines, county.lines$GEOID == 48291)
all.counties <- rbind(harris, brazoria, galveston, chambers, liberty)
ShapePoly <- as(all.counties, "SpatialPolygons")
study.area <- as(ShapePoly, "owin")
按预期绘制研究区域。
为了绘制炼油厂数据,我使用了以下代码
refinery <- data.frame(refinery)
attach(refinery)
refinery <- ppp(coords.x1, coords.x2, window = study.area)
炼油厂数据最初是一个 shapefile。我将其转换为数据框,以便可以使用 ppp()。
出现的问题是当我绘制炼油厂时没有点,只有形状文件。
plot(refinery, pch = 20, col = "firebrick1")
我正在为一个类项目编写此脚本,并且通常将 ArcGIS 用于我的空间项目。我不确定是什么原因造成的,因为我对 ppp 函数进行了广泛的研究,并使用不同的数据集复制了此代码。我希望将炼油厂绘制为县 shapefile 的点。
【问题讨论】:
-
ppp使用 lon-lat 而不是 lat-lon 如果切换 x1 和 x2 会发生什么? -
@G5W 我的积分是用 lon-lat 输入的。我确实尝试切换 x1 和 x2,但无法在研究区域中绘制任何点。
标签: r plot geospatial spatstat