I loaded spatstat, maptools, rgdal packages.
I want to generate random point pattern with different window derived from
polygon shp file.
but i can not pass new owin argument to rpoispp

> spdf = readOGR(dsn="polygon.shp",layer= "polygon")
> sp_owin = as(as(spdf,"SpatialPolygons"),"owin")

> sp_owin
window: polygonal boundary
enclosing rectangle: [483340, 488560] x [4414500, 4417200] units

> class(sp.owin)
[1] "owin"

> str(sp_owin)
List of 5
 $ type  : chr "polygonal"
 $ xrange: num [1:2] 483340 488559
 $ yrange: num [1:2] 4414483 4417208
 $ bdry  :List of 1
  ..$ :List of 4
  .. ..$ x   : num [1:4] 488559 483340 483868 488278
  .. ..$ y   : num [1:4] 4416729 4417208 4414516 4414483
  .. ..$ area: num 11857425
  .. ..$ hole: logi FALSE
 $ units :List of 3
  ..$ singular  : chr "unit"
  ..$ plural    : chr "units"
  ..$ multiplier: num 1
  ..- attr(*, "class")= chr "units"
 - attr(*, "class")= chr "owin"

> grpp = rpoispp(100000, win=sp_owin) # this does not work
> grpp = rpoispp(100000, win=owin(sp_owin$xrange,sp_owin$yrange)) # also
this one
> grpp = rpoispp(100000,
win=owin(c(sp_owin$xrange[1],sp_owin$xrange[2]),c(sp_owin$yrange[1],sp_owin$yrange[2])))
# and this one

all three variations of rpoispp, gives this error:

Error in runif(n, min = win$xrange[1], max = win$xrange[2]) :
  invalid arguments
In addition: Warning message:
In runif(n, min = win$xrange[1], max = win$xrange[2]) :
  NAs introduced by coercion

for unit square, it works.
> grpp = rpoispp(100, win=owin(c(0,10),c(0,10)))
> grpp
 planar point pattern: 9947 points
window: rectangle = [0, 10] x [0, 10] units

used spatstat version is: 1.15-2
is it a bug or related the data i used or missed something ?
how can i do, please, help me?


-- 
Regards,
Volkan Osman Kepoglu
PhD Candidate
GGIT Department in METU,
http:/ggit.metu.edu.tr

	[[alternative HTML version deleted]]

