#!/bin/sh # ############################################################################ # # MODULE: v.convert.all # AUTHOR(S): MN # PURPOSE: converts all old GRASS < V5.7 vector maps to current format # in current mapset # COPYRIGHT: (C) 2004 by the GRASS Development Team # # This program is free software under the GNU General Public # License (>=v2). Read the file COPYING that comes with GRASS # for details. # ############################################################################# #%Module #% description: convert all old GRASS < V5.7 vector maps in current mapset to current format #% keywords: vector, import #%end #%flag #% key: r #% description: run non-interactively #%end if test "$GISBASE" = ""; then echo "You must be in GRASS GIS to run this program." >&2 exit 1 fi if [ $# -eq 0 ] || [ $1 = "-h" -o $1 = "help" -o $1 = "-help" -o $1 = "--help" ] ; then if [ "$1" != "@ARGS_PARSED@" ] ; then exec g.parser "$0" "$@" fi fi eval `g.gisenv` : ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?} LOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET CONVERTEDMAPS=0 for i in `g.mlist type=oldvect` do # polish map names to be SQL compliant INPUT=$i OUTPUT=`echo $INPUT | sed 's+\.+_+g'` #do it: v.convert in=$INPUT out=$OUTPUT if [ $? -ne 0 ] ; then echo "ERROR converting map $INPUT to $OUTPUT" else CONVERTEDMAPS=`expr $CONVERTEDMAPS + 1` fi done if [ $CONVERTEDMAPS -lt 1 ] ; then echo "No vector maps converted as no old vector maps present in current mapset <$MAPSET>." else echo "Total $CONVERTEDMAPS number of vector maps in current mapset converted. Please verify new vector map(s) before deleting old vector map(s)." fi exit 0