[R] spatstat => owin + image

tkdweber tkd.weber at gmail.com
Fri Sep 23 16:32:17 CEST 2011

Dear Community

I am at my wits end and seek advice.
My wish is to plot coordinates (x,y in WGS84_UMTS for the ones interested)
of sampling points.
This I can do by the standard spatstat prodcedure via owin. I then try to
add an image, which is
a map/satellite photo in the background.

Problem: With the current code, I can not get the edges of the image to
match the boarders of the plot
itself (not the entire plot window, solely the coordinate system)
The size of the image I have (from GPS work)

Any ideas?

Secondly, I am confused of how to get coordinates into an owin plot. It
doesnt want to work.

Thirdly, is with spatstat only always one mark possible? Or can I
differentiate further?

Code, for reference purposes
~~~~~~~~~~~~~~~~  CODE ~~~~~~~~~~~~~~
data data = read.xls("name.xls")

x1=floor(min( data[,2],na.rm=T )*(1-b))
x2=ceiling(max(data[,2],na.rm=T )*(1+b))
y1=floor(min(data[,3],na.rm=T )*(1-c))
y2=ceiling(max(data[,3],na.rm=T )*(1+c))

w = owin(c(x1,x2),c(y1,y2))
dat1 = as.ppp(data[,2:4],w)

#Get the plot information so the image will fill the plot box, and draw it
ima = readPNG("file.png")
lim = par()
rasterImage(ima, lim$usr[1], lim$usr[3], lim$usr[2], lim$usr[4])

plot(dat1, use.marks=T)

Thank you for any advice.

Kind Regards


View this message in context: http://r.789695.n4.nabble.com/spatstat-owin-image-tp3837023p3837023.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list