#!/usr/bin/env python #**************************************************************** #* #* MODULE: v.elimina, v 1.0.0 #* #* AUTHOR(S): Antonio Alliegro #* #* PURPOSE: Elimina coperture vettoriali #* #* COPYRIGHT: (C) 2011 Antonio Alliegro Civil Engineer #* Salerno, Italy #* antonioall(at)libero.it #* #* First Version: 2011/06/21 #* Last Version: 2011/06/21 #* #* This program is free software under the #* GNU General Public License (>=v2). #* Read the file COPYING that comes with GRASS #* for details. #* #**************************************************************** #%module #% description: Elimina coperture vettoriali #% keywords: vector #%end #%option #% key: map #% type: string #% gisprompt: old,vector,vector #% key_desc: nome #% description: Nome copertura vettoriale #% required: yes #%end import sys, time import grass.script as grass def remove(cover_name): i = 0 while grass.find_file(cover_name, element = 'vector')['fullname'] != '' and i < 5: ret = grass.parse_command('g.remove', flags = 'f', vect = cover_name, quiet = True) i += 1 if grass.find_file(cover_name, element = 'vector')['fullname'] == '': grass.message("File <%s> rimosso al tentativo n. %d" % (cover_name, i)) return 0 #End remove def main(): copertura = options['map'] remove(copertura) return 0 #End main if __name__ == "__main__": options, flags = grass.parser() sys.exit(main())