[R-sig-Geo] problem with "overlay" in sp Error type: object of type 'closure' is not subsettable

Edzer Pebesma edzer.pebesma at uni-muenster.de
Tue Apr 5 20:11:38 CEST 2011



On 04/05/2011 05:32 PM, gianni lavaredo wrote:
> Dear Researchers,
> 
> I have two "SpatialPointsDataFrame" layer "p" and "onePLOT"  and I wish to
> do an overlay, but I have an error message
> 
>> str(p)
> Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
>   ..@ data       :'data.frame': 980000 obs. of  1 variable:
>   .. ..$ V3: num [1:980000] 1 1 1 1 1 1 1 1 1 1 ...
>   ..@ coords.nrs : int [1:2] 1 2
>   ..@ coords     : num [1:980000, 1:2] 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5
> 9.5 ...
>   .. ..- attr(*, "dimnames")=List of 2
>   .. .. ..$ : NULL
>   .. .. ..$ : chr [1:2] "x" "y"
>   ..@ bbox       : num [1:2, 1:2] 0.5 0.5 1399.5 699.5
>   .. ..- attr(*, "dimnames")=List of 2
>   .. .. ..$ : chr [1:2] "x" "y"
>   .. .. ..$ : chr [1:2] "min" "max"
>   ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
>   .. .. ..@ projargs: chr NA
> 
> 
>> str(onePLOT)
> Formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots
>   ..@ data       :'data.frame': 1 obs. of  2 variables:
>   .. ..$ Id      : Factor w/ 98 levels "LIDAR_Sicily_Area1_Plot1",..: 1
>   .. ..$ firecode: num 1
>   ..@ polygons   :List of 1
>   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
>   .. .. .. ..@ Polygons :List of 1
>   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
>   .. .. .. .. .. .. ..@ labpt  : num [1:2] 59 648
>   .. .. .. .. .. .. ..@ area   : num 900
>   .. .. .. .. .. .. ..@ hole   : logi FALSE
>   .. .. .. .. .. .. ..@ ringDir: int 1
>   .. .. .. .. .. .. ..@ coords : num [1:5, 1:2] 39.9 50 78.2 68.1 39.9 ...
>   .. .. .. .. .. .. .. ..- attr(*, "dimnames")=List of 2
>   .. .. .. .. .. .. .. .. ..$ : NULL
>   .. .. .. .. .. .. .. .. ..$ : chr [1:2] "x" "y"
>   .. .. .. ..@ plotOrder: int 1
>   .. .. .. ..@ labpt    : num [1:2] 59 648
>   .. .. .. ..@ ID       : chr "1"
>   .. .. .. ..@ area     : num 900
>   ..@ plotOrder  : int 1
>   ..@ bbox       : num [1:2, 1:2] 39.9 628.7 78.2 667.1
>   .. ..- attr(*, "dimnames")=List of 2
>   .. .. ..$ : chr [1:2] "x" "y"
>   .. .. ..$ : chr [1:2] "min" "max"
>   ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
>   .. .. ..@ projargs: chr NA
> 
> 
> when I try overlay I have this error message
> 
>> p.ov <- overlay[onePLOT["Id"],p]
> Error in overlay[onePLOT["Id"], p] :

Maybe you mean

overlay(onePlot["Id"], p)

?
Are you looking for coinciding points? In that case, there is also the
function zerodist.

Hth,

>   object of type 'closure' is not subsettable
> 
> thanks for help or suggestions
> Gianni
> 
> 	[[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
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list