[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.

Firstly
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))
x1
x2
y1
y2

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

#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])
par(new=T)

plot(dat1, use.marks=T)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thank you for any advice.

Kind Regards

TKD


--
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