[R-sig-Geo] spsample Error

Roger Bivand Roger.Bivand at nhh.no
Tue Jul 7 13:24:50 CEST 2009


On Tue, 7 Jul 2009, Agustin Lobo wrote:

> I'm using spsample() with a second SpatialLinesDataFrame
> but now I'm geting an error. This is what I do:
>
> fl2300 <-
> readOGR(dsn="/media/Transcend/MONTSENY2008/MONTSENY_UAV2/flMatagalls300",layer="flMatagalls300")
>> wpMata300 <- spsample(fl2300[1,],33,offset=0.0,type="regular")
> Error in proj4string(x) :
>  proj4string only works for class(es extending) Spatial

With the actual data, this cannot be reproduced in current CVS sp. The 
version you are using is probably 0.9-38 (also CVS, unreleased). I've been 
trying to test edge conditions so that solutions to your problems don't 
break things for others. If you need immediate turnaround (as your many 
messages suggest), please take this off-list, and wait for replies. 
Consider using the developer mailing list on sourceforge.

Roger

>
> Nothing looks wrong with fl2300 (at least not different to other SPDFs for 
> which
> spsample() works fine):
>> str(fl2)
> Formal class 'SpatialLinesDataFrame' [package "sp"] with 4 slots
>  ..@ data       :'data.frame':	2 obs. of  2 variables:
>  .. ..$ Code   : int [1:2] 1 2
>  .. ..$ Comment: Factor w/ 2 levels "CarrElBrull700",..: 2 1
>  ..@ lines      :List of 2
>  .. ..$ :Formal class 'Lines' [package "sp"] with 2 slots
>  .. .. .. ..@ Lines:List of 1
>  .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slots
>  .. .. .. .. .. .. ..@ coords: num [1:3, 1:2] 445816 449071 449071 4628083
> 4629045 ...
>  .. .. .. ..@ ID   : chr "0"
>  .. ..$ :Formal class 'Lines' [package "sp"] with 2 slots
>  .. .. .. ..@ Lines:List of 1
>  .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slots
>  .. .. .. .. .. .. ..@ coords: num [1:3, 1:2] 445983 444326 444326 4628196
> 4630060 ...
>  .. .. .. ..@ ID   : chr "1"
>  ..@ bbox       : num [1:2, 1:2] 444326 4628083 449071 4630060
>  .. ..- attr(*, "dimnames")=List of 2
>  .. .. ..$ : chr [1:2] "r1" "r2"
>  .. .. ..$ : chr [1:2] "min" "max"
>  ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
>  .. .. ..@ projargs: chr " +proj=utm +zone=31 +ellps=intl +units=m +no_defs"
>
> Is this a bug? Do I have anything wrong in this object?
> Thanks
>
> Agus
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list