[GRASS-SVN] r42228 - grass/trunk/scripts/v.in.mapgen
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed May 12 01:47:37 EDT 2010
Author: martinl
Date: 2010-05-12 01:47:36 -0400 (Wed, 12 May 2010)
New Revision: 42228
Modified:
grass/trunk/scripts/v.in.mapgen/v.in.mapgen.py
Log:
fix #1065
Modified: grass/trunk/scripts/v.in.mapgen/v.in.mapgen.py
===================================================================
--- grass/trunk/scripts/v.in.mapgen/v.in.mapgen.py 2010-05-11 19:10:25 UTC (rev 42227)
+++ grass/trunk/scripts/v.in.mapgen/v.in.mapgen.py 2010-05-12 05:47:36 UTC (rev 42228)
@@ -12,21 +12,19 @@
#
# COPYRIGHT: Original version (c) Andreas Lange
# Updates by Hamish Bowman
-# (C) 2008 the GRASS Development Team
+# (C) 2008, 2010 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.
#############################################################################
#
-# REQUIREMENTS: awk
-#
# DATA AVAILABILITY: e.g., NOAA's Online Coastline Extractor
# http://www.ngdc.noaa.gov/mgg/shorelines/shorelines.html
#
#%Module
-#% description: Import Mapgen or Matlab vector maps into GRASS.
+#% description: Imports Mapgen or Matlab vector maps into GRASS.
#% keywords: vector
#% keywords: import
#%End
@@ -78,7 +76,7 @@
opts = ""
if not os.path.isfile(infile):
- grass.fatal(_("Input file <%s> not found.") % infile)
+ grass.fatal(_("Input file <%s> not found") % infile)
if output:
name = output
@@ -99,6 +97,7 @@
inf = file(infile)
outf = file(tmp, 'w')
+ grass.message(_("Importing data..."))
if matlab:
## HB: OLD v.in.mapgen.sh Matlab import command follows.
## I have no idea what it's all about, so "new" matlab format will be
@@ -139,6 +138,7 @@
points = []
else:
points.append(line.rstrip('\r\n').split('\t'))
+
if points != []:
outf.write("L %d\n" % len(points))
for point in points:
@@ -157,7 +157,7 @@
MAP NAME: $name
MAP DATE: $year
MAP SCALE: 1
-OTHER INFO: Imported with $proj
+OTHER INFO: Imported with $prog
ZONE: 0
MAP THRESH: 0
VERTI:
@@ -166,10 +166,11 @@
year = time.strftime("%Y")
user = os.getenv('USERNAME') or os.getenv('LOGNAME')
host = os.getenv('COMPUTERNAME') or os.uname()[1]
+
s = t.substitute(prog = prog, name = name, date = date, year = year,
user = user, host = host)
outf.write(s)
-
+
#### process points list to ascii vector file (merge in vertices)
inf = file(tmp)
shutil.copyfileobj(inf, outf)
@@ -179,17 +180,14 @@
if not name:
#### if no name for vector file given, cat to stdout
- grass.message(_("Output to stdout"))
inf = file(digfile)
shutil.copyfileobj(inf, sys.stdout)
inf.close()
else:
#### import to binary vector file
- grass.message(_("Importing with v.in.ascii ..."))
+ grass.message(_("Importing with v.in.ascii..."))
if grass.run_command('v.in.ascii', flags = do3D, input = digfile,
- output = name, format = 'standard') == 0:
- grass.message(_('"%s" successfully created') % name)
- else:
+ output = name, format = 'standard') != 0:
grass.fatal(_('An error occured on creating "%s", please check') % name)
if __name__ == "__main__":
More information about the grass-commit
mailing list