[R-sig-Geo] Fail to load a vector layer using spgrass6

Roger Bivand Roger.Bivand at nhh.no
Mon Dec 13 08:06:25 CET 2010


On Mon, 13 Dec 2010, Pierre Roudier wrote:

> Dear list,
>
> I'm using R from GRASS using the great spgrass6 connector. For some
> reason, I can't manage to load a GRASS vector layer into my R session.
> I'm just beginning with GRASS, and I really have no clue here...
> I hope this is a good place to ask (being on the borderline I hesitaed
> to ask the question to the GRASS-user mailing list).
>
> First here's the rror message in the R session:
>> ph <- readVECT6('ph_cl', type='area')
> Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
> input_field_name_encoding) :
>  Cannot open layer

Because there are two routes used depending on the setting of the plugin= 
argument, could you look at ogrDrivers() and see if you have an OGR GRASS 
vector driver, and if so, try to set plugin= manually to TRUE and FALSE?

Note that GRASS 7.0svn is the development version, snd is very much a 
moving target - do you have to use this version? And GDAL 1.7.1 is not the 
current version, which is 1.7.3. Did you install GDAL and/or GRASS from 
source, or from binaries (in my experience, installing from source ensures 
more consistency, and the GDAL/OGR GRASS plugins are often the source of 
problems because of version mismatch).

Roger

PS. The best list is probably:

http://grass.osgeo.org/statsgrass/index.php

as it is more specific, and also seen by GRASS developers.

>
> I tried to play with the different options but I did not succeed>
> Here's more info about my data and platform:
>
> Here is the output of v.info for the data I want to load:
> GRASS 7.0.svn (NZTM2000):~ > v.info ph_cl
> +----------------------------------------------------------------------------+
> | Name:            ph_cl                                                     |
> | Mapset:          nitrif_inhib                                              |
> | Location:        NZTM2000                                                  |
> | Database:        /home/roudierp/Documents/GRASSDATA                        |
> | Title:                                                                     |
> | Map scale:       1:1                                                       |
> | Map format:      native                                                    |
> | Name of creator: roudierp                                                  |
> | Organization:                                                              |
> | Source date:     Mon Dec 13 11:30:11 2010                                  |
> |----------------------------------------------------------------------------|
> |   Type of map: vector (level: 2)                                           |
> |                                                                            |
> |   Number of points:       0               Number of centroids:  236847     |
> |   Number of lines:        0               Number of boundaries: 892041     |
> |   Number of areas:        355021          Number of islands:    79124      |
> |                                                                            |
> |   Map is 3D:              No                                               |
> |   Number of dblinks:      1                                                |
> |                                                                            |
> |   Projection: Transverse Mercator                                          |
> |                                                                            |
> |               N:  6190887.80270169    S:  4823266.04395524                 |
> |               E:  2091804.65744429    W:   1170289.3071784                 |
> |                                                                            |
> |   Digitization threshold: 0                                                |
> |   Comment:                                                                 |
> |                                                                            |
> +----------------------------------------------------------------------------+
>
> And finally some metadata about the software packages I used:
>
> here's the sessionInfo():
>
>> sessionInfo()
> R version 2.12.0 (2010-10-15)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
> [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C
> [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8
> [5] LC_MONETARY=C              LC_MESSAGES=en_GB.UTF-8
> [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C
> [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] spgrass6_0.6-21 XML_3.2-0       rgdal_0.6-31    sp_0.9-74
>
> loaded via a namespace (and not attached):
> [1] grid_2.12.0     lattice_0.19-13
>
>> library(spgrass6)
> Loading required package: sp
> Loading required package: rgdal
> Geospatial Data Abstraction Library extensions to R successfully loaded
> Loaded GDAL runtime: GDAL 1.7.1, released 2010/02/08
> Path to GDAL shared files: /usr/share/gdal
> Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009
> Path to PROJ.4 shared files: /usr/share/proj/
> Loading required package: XML
> GRASS GIS interface loaded with GRASS version: 7.0.svn
> and location: NZTM2000
>
> I got the last CRAN version of sp.
>
> This runs on a linux machine:
> GRASS 7.0.svn (NZTM2000):~ > uname -a
> Linux A208_RoudierP 2.6.34.7-0.5-xen #1 SMP 2010-10-25 08:40:12 +0200
> x86_64 x86_64 x86_64 GNU/Linux
>
>
> Cheers,
>
> Pierre
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
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 at nhh.no



More information about the R-sig-Geo mailing list