[GRASS-user] r.external across Windows and Linux

Glynn Clements glynn at gclements.plus.com
Tue Apr 21 12:17:58 PDT 2015


Blumentrath, Stefan wrote:

> Thanks for your reply. Here is a more detailed problem description:
> 
> First I created a new and empty GRASS Location "test" on the network
> storage (NFS) from the Linux Server. This GRASS DB is mounted on
> LINUX (through mount.cifs) to `/home/stefan/R_raw_data/test'. On
> Windows the "Network drive" is mapped to " R:\Raw_data\test "
> 
> Within this Location I crated a mapset "linux" (from the Linux
> Server) and a mapset "windows" from my Windows 7 workstation.
> 
> 1st test case: Linux to Windows:
> On the Linux  server, and in the "linux" mapset I did:
> 
> r.external.out --verbose directory="/home/stefan/R_raw_data/test" extension=".tif" format="GTiff"
> g.region -p n=1 s=0 e=1 w=0 res=0.1
> r.mapcalc expression="linux_map=1"
> 
> On my Win 7 box I did:
> 
> d.rast map= linux_map @linux
> Here I got the following error message:
> 
> Command 'd.rast map=linux_map at linux' failed
> Details: ERROR 4: `/home/stefan/R_raw_data/test/linux_map.tif' does
> not exist in the file system, and is not recognised as a supported
> dataset name.
> 
> Then I tried relative paths:
> On Linux:
> r.external.out --verbose directory="../../" extension=".tif" format="GTiff"
> r.mapcalc expression="linux_map=1" --o
> 
> Error message on Windows changes to:
> Command 'd.rast map=linux_map at linux' failed
> Details: ERROR 4:
> `/home/stefan/R_raw_data/test/newLocation/linux/../..//linux_map.tif'
> does not exist in the file system, and is not recognised as a
> supported dataset name.

Okay, so the issue is the use of absolute paths which may be incorrect
if the database is accessed via a networked filesystem (or even a
local filesystem if the mount point changes).

Currently, if the directory given to r.external.out is relative
(doesn't begin with a "/"), it's converted to an absolute path
relative to the current mapset directory.

Thereafter, any created maps will have the absolute path in their GDAL
link (i.e. the cell_misc/<map>/gdal file).

Thus, maps created with r.external.out can't be read if the database
directory has "moved" relative to its location when the map was
created.

> Should I open a ticket in trac?

Yes.

We should at least support paths relative to the mapset, and may need
additional options, e.g. the ability to use environment variables in
paths).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list