NAME
g.rename.many - Renames multiple maps in the current mapset.
KEYWORDS
general,
map management,
rename
SYNOPSIS
g.rename.many
g.rename.many --help
g.rename.many [-sd] [raster=name] [raster_3d=name] [vector=name] [separator=character] [--help] [--verbose] [--quiet] [--ui]
Flags:
- -s
- Skip file format and map existence checks
- By default a file format check is performed and existence of map is checked before the actual renaming. This requires going through each file two times. It might be advantageous to disable the checks for renames of large number of maps. However, when this flag is used an error occurs, some maps might be renamed while some others not.
- -d
- Do the checks only (dry run)
- This will only perform the file format and map existence checks but it will not do the actual rename. This is useful when writing the file with renames.
- --help
- Print usage summary
- --verbose
- Verbose module output
- --quiet
- Quiet module output
- --ui
- Force launching GUI dialog
Parameters:
- raster=name
- File with rasters to be renamed
- Format of the file is one raster map per line. Old name first, new name second (separated by comma by default)
- raster_3d=name
- File with 3D rasters to be renamed
- Format of the file is one raster map per line. Old name first, new name second (separated by comma by default)
- vector=name
- File with vectors to be renamed
- Format of the file is one vector map per line. Old name first, new name second (separated by comma by default)
- separator=character
- Field separator
- Special characters: pipe, comma, space, tab, newline
- Default: comma
g.rename.many renames multiple maps at once using
g.rename module.
Old and new names are read from a text file.
The file format is a simple CSV (comma separated values) format
with no text delimiter (e.g. no quotes around cell content).
Comma is a default cell delimiter but it can be changed to anything.
Possible use cases include:
-
renaming maps named in a certain language to English
when data were obtained at national level but the futher
collaboration is international
-
renaming provided sample maps with English names to
a national language for educational purposes in case
English is not appropriate
-
preparation of a
GRASS GIS Standardized Sample Dataset which requires
a certain set of standardized names
First prepare a file with names of raster maps to be renamed.
The file can be prepared in spreadsheet application
(and saved as CSV with cell delimiter comma and no text delimiter)
or as a text file in any (plain) text editor.
In any case, the result should be a plain text file with format and
content similar to the following sample:
landuse96_28m,landuse
geology_30m,geology
soilsID,soils
Once the file is prepared, the module can be called:
g.rename.many raster=raster_names.csv
This example worked only with raster maps. However multiple files, one
for each map type, can be used at once.
A template for renaming can be prepared using
g.list module,
for example in command line (bash syntax):
g.list type=raster mapset=. sep=",
" > raster_names.csv
Note that we are using only maps in a current Mapset because these
are the only ones we can rename.
With some further processing file template can be made more complete
by including map names twice (bash syntax):
g.list type=raster mapset=. | sed -e "s/\(.*\)/\1,\1/g" > raster_names.csv
The
sed expression used here takes whatever is on a line
on input and puts it twice on one line on the output separated by comma.
g.rename,
g.list
Vaclav Petras,
NCSU OSGeoREL
SOURCE CODE
Available at:
g.rename.many source code
(history)
Latest change: Wednesday Mar 30 10:17:35 2022 in commit: 25b0a9981b66c443a1c1af1d5f26182c93268b45
Main index |
General index |
Topics index |
Keywords index |
Graphical index |
Full index
© 2003-2024
GRASS Development Team,
GRASS GIS 8.4.1dev Reference Manual