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

> On Tue, 31 Mar 2009, Rainer M Krug wrote:
>
>  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.
>>
>>
> For what definition of tricky? The CRAN Windows binary ships with its own
> GDAL binaries and support files (thanks to Uwe Ligges), so I don't think it
> is harder to install than maptools (but is a much larger download for
> obvious reasons - it includes quite a lot of raster and vector drivers, and
> the GDAL and PROJ.4 support metadata files).


OK - you are right: then it is not tricky at all. I googled and must have
found only old web pages...


>
>
>
>>  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?
>>
>
> sp_0.9-34.tar.gz submitted to CRAN, so probably tomorrow for the Windows
> build if it passes checks.


perfect.

Thanks again - that's exactly why I like R.

Rainer

>
>
> Roger
>
>
>
>> 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
>>>
>>>
>>>
>>
>>
>>
> --
> 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]]

