r - An irregular polygon area as plot on spatstat -
it's first time using spatstat package, advice. attempting plot coordinate info irregular polygon area (format .shp), calculate spatial analysis ripley's k. how can add together irregular polygon area plot? how can merge .ppp info coordinates polygon area? have used next codes:
converting coordinate info .ppp format
library(spatstat) library(sp) library(maptools) tree.simu <- read.table("simulation.txt", h=t) tree.simu.ppp <-ppp(x=tree.simu$x,y=tree.simu$y,window=owin(c(min(tree.simu$x),max(tree.simu$x)),c(min(tree.simu$y),max(tree.simu$y)))) plot(tree.simu.ppp)
with function considering plot area max , min valeu of coordinates. set polygon boundary plot.
ploting irregular polygon area
area <- readshapepoly("area/fragment.shp") plot(area) plot(tree.simu.ppp, add=t)
or
points(tree.simu.ppp)
the bundle take lastly function but, when seek plot both files together, seems .shp file fill whole area. can't visualize coordinates data.
thank you, appreciate help!
ps.: if know material question, please happy take look
this indeed due inconsistent bounding boxes conjectured in comment @jlhoward. points in [273663.9, 275091.45] x [7718635, 7719267] while polygon contained in [-41.17483, -41.15588] x [-20.619647, -20.610134].
assuming coordinates indeed consistent window right way way of getting ppp
object be:
library(spatstat) library(sp) library(maptools) area <- readshapepoly("area/fragment.shp") area <- as(area, "owin") tree.simu <- read.table("simulation.txt", h=t) tree.simu.ppp <-ppp(x=tree.simu$x,y=tree.simu$y,window=area)
however, warning points beingness rejected since outside window, , object contain no points.
r plot polygon spatial spatstat
No comments:
Post a Comment