Skip to content
Back to formatted view

Raw Message

Message-ID: <57334F8B.7030200@uni-muenster.de>
Date: 2016-05-11T15:28:11Z
From: Edzer Pebesma
Subject: spsample bug?
In-Reply-To: <CAHMizkPYCE70GWeD9xVMtSR4Qn2z2Aj9Cj3roTy9rKm=5k=VVQ@mail.gmail.com>

On 11/05/16 14:51, Juta Kawalerowicz wrote:
> Hi I encountred a problme when running a loop to generate randomly
> distributed points within a polygon. The error I get is:
> 
> Error in .local(x, n, type, ...) :
> iteration did not converge; try enlarging argument iter

did you try enlarging argument iter? For me this worked:

  ...
  points <- spsample(dry.grid.u, n = n, type = "random", iter = 6)

> 
> Here is the code which allows to get this error (although you will get it
> for different i). Any ideas would be much appreciated.
> 
> Juta
> 
> ###import polygon shapefile from Dropbox
> con <- url("https://www.dropbox.com/s/b6v2e14dr6rn3zw/spsample.RData?raw=1")
> load(con)
> 
> #see what's inside
> plot(dry.grid.u, col="red", axes=TRUE)
> class(dry.grid.u)
> 
> #let's say we want 11 points generated
> n<-11
> #works fine for doing it just once
> points<-spsample(dry.grid.u,n=n,type="random")
> plot(points, add=TRUE)
> 
> #but when looped over many times there is a problem
> 
>   for (i in 1:5000){
>     print(i)
>     points<-spsample(dry.grid.u,n=n,type="random")
>   }
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics  (ifgi),  University of M?nster
Heisenbergstra?e 2, 48149 M?nster, Germany; +49 251 83 33081
Journal of Statistical Software:   http://www.jstatsoft.org/
Computers & Geosciences:   http://elsevier.com/locate/cageo/
Spatial Statistics Society http://www.spatialstatistics.info

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20160511/18d33318/attachment.bin>