[GRASS-stats] Mapset issue with vector data via OGR plugin

Roger Bivand Roger.Bivand at nhh.no
Fri Aug 14 05:40:09 EDT 2009


On Fri, 14 Aug 2009, Markus Neteler wrote:

> Hi,
>
> I have some troubles when the vector map name contains the
> @mapset part:
>

Hi,

This is a consequence of the plugin only searching in the current user's 
mapset, so using extra code to scan other mapsets:

         if (is.null(mapset)) mapset <- .g_findfile(vname[1], type="vector")
         dsn <- paste(gg$GISDBASE, gg$LOCATION_NAME, mapset,
             "vector", vname, "head", sep="/")

where .g_findfile() runs g.findfile. This seems to fail when @mapset is 
given. I guess that the work-around is to use the argument 
mapset="neteler" in readVECT6() and readRAST6() for now, but I could look 
at trying to detect the @ and use it (in the plugin case only) to assign 
to a null mapset, throwing an error if mapset is non-null and @ is used.

Hope this helps,

Roger

>
> R
> R version 2.9.1 (2009-06-26)
> ...
>> 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.0dev, released 2008/11/26
> Path to GDAL shared files: /usr/local/share/gdal
> Loaded PROJ.4 runtime: Rel. 4.6.1, 21 August 2008
> Path to PROJ.4 shared files: (autodetected)
> Loading required package: XML
>
>> data <- readVECT6("rand5k_elev_filt at neteler", type= 'point')
> Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
> input_field_name_encoding) :
>  Cannot open file
>
> while this works:
>
>> data <- readVECT6("rand5k_elev_filt", type= 'point')
> OGR data source with driver: GRASS
> Source: "/home/neteler/grassdata/spearfish60/neteler/vector/rand5k_elev_filt/head",
> layer: "1"
> with 4885 features and 5 fields
> Feature type: wkbPoint with 2 dimensions
>
> I have used update.packages() and should have the latest sp* packages.
> I tried to debug the problem but failed...
>
> Can anyone confirm this problem?
>
> thanks
> Markus
> _______________________________________________
> grass-stats mailing list
> grass-stats at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-stats
>

-- 
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 grass-stats mailing list