On Tue, Mar 31, 2009 at 2:16 PM, Roger Bivand <Roger.Bivand@nhh.no> wrote:

> On Tue, 31 Mar 2009, Rainer M Krug wrote:
>
>  Hi
>>
>> I want to get the data from a grid at locations based in a point vector
>> file. I am using the following code, and I get the error below.
>>
>
> Rainer:
>
> The quick workaround is to read the shapefile with readOGR(), which does
> not give the coordinates matrix row names, so the failing test for matching
> with


Yes - it works with readOGR, which I like. But the problem is, that most
attendants of the course use Windows (unfortunately), and as faer as I know
is rgdal on windows tricky.


> data frame row names is skipped. I have fixed overlay() to suit in sp's CVS
> on R-spatial on sourceforge - could you try it, please? The following will
> show if it


OK - it's working now. ANy idea when this will be available on CRAN?

Thanks a lot,

Rainer

is fixed:
>
> library(sp)
> data(meuse)
> coordinates(meuse) <- c("x", "y")
> data(meuse.grid)
> coordinates(meuse.grid) <- c("x", "y")
> gridded(meuse.grid) <- TRUE
> fullgrid(meuse.grid) <- TRUE
> zz <- overlay(meuse.grid, meuse)
> library(rgdal)
> writeOGR(meuse, "/tmp", "meuse", driver="ESRI Shapefile")
> meuse <- readOGR("/tmp", "meuse")
> zz <- overlay(meuse.grid, meuse)
> library(maptools)
> meuse <- readShapePoints("/tmp/meuse.shp")
> zz <- overlay(meuse.grid, meuse)
>
> Hope this helps,
>
> Roger
>
>
>
>
>> Could anybody help to solve this?
>>
>> Thanks
>>
>> Rainer
>>
>>
>>  lastFire <- readAsciiGrid("fire_last_2006.asc")
>>> biota <- readShapePoints("Biota")
>>> overlay(lastFire, biota)
>>>
>> Error in SpatialPointsDataFrame(cc, x@data[idx, , drop = FALSE],
>> proj4string
>> = CRS(proj4string(x))) :
>>  row.names of data and coords do not match
>>
>>>
>>>
>>
>>
> --
> 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@nhh.no
>
>


-- 
Rainer M. Krug, Centre of Excellence for Invasion Biology, Stellenbosch
University, South Africa

	[[alternative HTML version deleted]]

