Can I convert kernel density plots to raster and then overlay them using map algebra?

回眸只為那壹抹淺笑 提交于 2019-12-11 06:15:19

问题


I am currently exploring three shapefiles, each with point data, and all confined to the same window. I also have them in ppp format which I've used to create kernel density maps.

plot(density.ppp(smktppp, 0.5, edge=T), main="Supermarket Density")
plot(density.ppp(tptppp, 0.5, edge=T), main="Transport Density")
plot(density.ppp(farmppp, 0.5, edge=T), main="Urban Farm Density")

I would like to overlay these plots, using map algebra, or fuzzy logic, etc, to create one output map showing the density of the three combined. How would I go about doing this in R?


回答1:


If you simply want to estimate the overall density (usually called intensity since it doesn't integrate to one) of points disregarding whether it is "Supermarket", "Transport" or "Urban Farm" you just combine all the points and do as before:

library(spatstat)
combined <- superimpose(smktppp, tptppp, farmppp)
plot(density(combined), main="Density of all points.")

Of course you can choose the smoothing bandwidth to be 0.5 as before or any other value you like.

You can also do normal algebra with the raster images produced by density.ppp (object of class im). If you saved these as smktim, tptim and farmim you can do something like rslt <- smktim + tptim + farmim to get the sum of the three estimates.




回答2:


Alternatively, if you combine the three point patterns into a single object

library(spatstat)
X <- superimpose(Supermarket=smktppp, Transport=tptppp, Farm=farmppp)

then you can display both the original data and the intensity estimates, with or without identifying the kind of point:

# original data:
plot(X)  # single plot with 3 different plot characters for 3 types 
plot(split(X)) # three plot panels, one for each type of point
plot(unmark(X)) # single plot without distinguishing types of points

# intensity images:
plot(density(X, 0.5)) # single plot: intensity regardless of type
plot(density(split(X), 0.5)) # three panels: intensity for each type
plot(relrisk(X), 0.5) # three panels: relative probabilities of each type

See the spatstat book for details.



来源:https://stackoverflow.com/questions/42459424/can-i-convert-kernel-density-plots-to-raster-and-then-overlay-them-using-map-alg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!