[R-sig-Geo] spsample Error

Paul Hiemstra p.hiemstra at geo.uu.nl
Tue Jul 7 12:52:31 CEST 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
Hi,

What is the information traceback() provides?

cheers,
Paul
>
> 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
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>   


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul



More information about the R-sig-Geo mailing list