[R-sig-Geo] spsample Error

Agustin Lobo alobolistas at gmail.com
Tue Jul 7 13:15:29 CEST 2009


Paul, this is it:

> wpMata300 <- spsample(fl2300[1,],33,offset=0.0,type="regular")
Error in proj4string(x) :
   proj4string only works for class(es extending) Spatial
> traceback()
16: stop("proj4string only works for class(es extending) Spatial")
15: proj4string(x)
14: identical(proj4string(x), p1)
13: FUN(X[[1L]], ...)
12: lapply(dots[-1], function(x) identical(proj4string(x), p1))
11: unlist(lapply(dots[-1], function(x) identical(proj4string(x),
         p1)))
10: checkCRSequal(dots)
9: rbind(deparse.level, ...)
8: rbind(<S4 object of class "SpatialPoints">, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL)
7: do.call("rbind", ret)
6: .local(x, n, type, ...)
5: spsample(x at lines[[i]], nrs[i], type = type, offset = offset,
        ...)
4: spsample(x at lines[[i]], nrs[i], type = type, offset = offset,
        ...)
3: .local(x, n, type, ...)
2: spsample(fl2300[1, ], 33, offset = 0, type = "regular")
1: spsample(fl2300[1, ], 33, offset = 0, type = "regular")

Thanks for your interest,

Agus

Paul Hiemstra wrote:
> 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
>>   
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alobolistas.vcf
Type: text/x-vcard
Size: 251 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20090707/cffa4348/attachment.vcf>


More information about the R-sig-Geo mailing list