#2282: r.external.out: keep GRASS maps and external files in sync
-------------------------+--------------------------------------------------
Reporter: sbl | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.1.0
Component: Default | Version: unspecified
Keywords: | Platform: Unspecified
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by glynn):
Replying to [comment:2 sbl]:
> 1) Let`s say a user sets the external output path to ~/output for
GeoTiffs with extension ."tif". Then the user produces a map with the name
"map_a". Later this "map_a" is renamed to "map_b". The file
"~/output/map_a.tif" will then be linked to "map_b", right? What happens
in such a case, if another map with the name "map_a" is produced. The map
name does not exist anymore in GRASS, but the file "~/output/map_a.tif"
does, on the file system. Is it checked that "~/output/map_a.tif" is not
overwritten in such a case.
I don't think so. Not unless GDALCreate() performs such a check.
It's awkward for GRASS to do it, because the "filename" (i.e. dataset
name) might not actually correspond to a file (although I'm not sure that
the code correctly handles non-file datasets at present).
> 2) Let`s assume one wants to use maps produced in GRASS with
r.external.out in other software. During map production the user finds
out, that a different name for the map would have been more suitable.
After running g.rename the new, more appropriate name is used in GRASS
while other software will still have to work with the old filename. The
way to sync that manually would be to remove the map (link) (instead of
renaming it), rename the underlying file (mv), and then link that file
again into GRASS (r.external). What happens to map history in such cases?
Removing the GRASS map (with g.remove) will remove any metadata which
isn't part of the underlying GDAL dataset (e.g. image file).
Currently, the only metadata GRASS stores in the file is the region
(bounds and resolution). The code is there to store the projection (SRS),
but that information isn't available at present (we'd need to move
GPJ_grass_to_wkt() etc from libgproj into libgis, which would make GDAL a
direct dependency of libgis).
> In general, I think having an option for keeping maps and files in sync
automatically would make it much more easy to maintain a tidy and clean
data storage with external files...
Probably. The main issue is whether it's feasible to modify the existing
management tools (g.rename etc) to handle this, or whether we need
specific tools related to GDAL-linked (r.external) maps. I suspect that
most of these issues would also apply to OGR-linked (v.external) vector
maps.
BTW, there would also be the issue of how to handle filenames which aren't
valid map names (as per G_legal_filename()), e.g. those containing spaces.
Or map names which aren't valid filenames (GRASS allows :?|<> in map
names, but Windows doesn't allow those characters in filenames).
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2282#comment:3>
GRASS GIS <http://grass.osgeo.org>