[GRASS-dev] [GRASS GIS] #2660: r.external.out: support paths relative to the mapset, and variables
GRASS GIS
trac at osgeo.org
Tue Apr 21 13:17:54 PDT 2015
#2660: r.external.out: support paths relative to the mapset, and variables
----------------------------+-----------------------------------------------
Reporter: sbl | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.1
Component: Raster | Version: svn-releasebranch70
Keywords: r.external.out | Platform: Unspecified
Cpu: Unspecified |
----------------------------+-----------------------------------------------
Currently, r.external.out uses 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).
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.
It would be helpful if paths relative to the mapset could be supported,
and maybe additional options, e.g. the ability to use environment
variables in paths
Here is a test case in order to reproduce the issue:
First I created a new and empty GRASS Location "test" on a 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.
}}}
2nd test case: Windows to Linux:
On my Windows box (and in the "windows" mapset) I did:
{{{
r.external.out --verbose directory="R:\Raw_data\test" extension=".tif"
format="GTiff"
r.mapcalc expression=windows_map=1
}}}
Which results in the following error message:
{{{
ERROR: Unable to make mapset element R:\Raw_data\test
(R:\Raw_data\test/newLocation/windows/R:\Raw_data\test): No such file or
directory
}}}
Then I tried relative paths:
{{{
r.external.out --verbose directory="../../" extension=.tif format=GTiff
}}}
The relative paths work for the Windows side. However, back on Linux I
tried:
d.rast map=windows_map at windows and got the following error message:
{{{
Command 'd.rast map=windows_map at windows' failed
Details: ERROR 4:
`R:\Raw_data\test/newLocation/windows/../..//windows_map.tif' does not
exist in the file system, and is not recognised as a supported dataset
name.
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2660>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list