[GRASS-SVN] r67651 - grass/trunk/scripts/v.import
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jan 24 11:33:09 PST 2016
Author: neteler
Date: 2016-01-24 11:33:09 -0800 (Sun, 24 Jan 2016)
New Revision: 67651
Modified:
grass/trunk/scripts/v.import/v.import.py
Log:
v.import: support overwriting
Modified: grass/trunk/scripts/v.import/v.import.py
===================================================================
--- grass/trunk/scripts/v.import/v.import.py 2016-01-24 19:24:24 UTC (rev 67650)
+++ grass/trunk/scripts/v.import/v.import.py 2016-01-24 19:33:09 UTC (rev 67651)
@@ -120,6 +120,7 @@
def main():
global TMPLOC, SRCGISRC, GISDBASE
+ overwrite = grass.overwrite()
# list formats and exit
if flags['f']:
@@ -183,7 +184,7 @@
vopts['snap'] = options['snap']
try:
grass.run_command('v.in.ogr', input=OGRdatasource,
- location=TMPLOC, flags='i', quiet=True, **vopts)
+ location=TMPLOC, flags='i', quiet=True, overwrite=overwrite, **vopts)
except CalledModuleError:
grass.fatal(_("Unable to create location from OGR datasource <%s>") % OGRdatasource)
@@ -201,10 +202,10 @@
# try v.in.ogr directly
if flags['o'] or grass.run_command('v.in.ogr', input=OGRdatasource, flags='j',
- errors='status', quiet=True) == 0:
+ errors='status', quiet=True, overwrite=overwrite) == 0:
try:
grass.run_command('v.in.ogr', input=OGRdatasource,
- flags=vflags, **vopts)
+ flags=vflags, overwrite=overwrite, **vopts)
grass.message(_("Input <%s> successfully imported without reprojection") % OGRdatasource)
return 0
except CalledModuleError:
@@ -237,7 +238,7 @@
os.environ['GISRC'] = str(SRCGISRC)
try:
grass.run_command('v.proj', input=vreg, output=vreg,
- location=tgtloc, mapset=tgtmapset, quiet=True)
+ location=tgtloc, mapset=tgtmapset, quiet=True, overwrite=overwrite)
except CalledModuleError:
grass.fatal(_("Unable to reproject to source location"))
@@ -249,7 +250,7 @@
grass.message(_("Importing <%s> ...") % OGRdatasource)
try:
grass.run_command('v.in.ogr', input=OGRdatasource,
- flags=vflags, **vopts)
+ flags=vflags, overwrite=overwrite, **vopts)
except CalledModuleError:
grass.fatal(_("Unable to import OGR datasource <%s>") % OGRdatasource)
@@ -273,7 +274,7 @@
grass.message(_("Reprojecting <%s>...") % output)
try:
grass.run_command('v.proj', location=TMPLOC,
- mapset='PERMANENT', input=output)
+ mapset='PERMANENT', input=output, overwrite=overwrite)
except CalledModuleError:
grass.fatal(_("Unable to to reproject vector <%s>") % output)
More information about the grass-commit
mailing list