[GRASS-SVN] r37201 - grass/trunk/scripts/m.proj
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed May 13 05:46:59 EDT 2009
Author: hamish
Date: 2009-05-13 05:46:59 -0400 (Wed, 13 May 2009)
New Revision: 37201
Modified:
grass/trunk/scripts/m.proj/m.proj.py
Log:
add flag to include input coordinates in output file; todo note (merge from devbr6)
Modified: grass/trunk/scripts/m.proj/m.proj.py
===================================================================
--- grass/trunk/scripts/m.proj/m.proj.py 2009-05-13 09:38:44 UTC (rev 37200)
+++ grass/trunk/scripts/m.proj/m.proj.py 2009-05-13 09:46:59 UTC (rev 37201)
@@ -18,6 +18,11 @@
# notes:
# - cs2cs expects "x y" data so be sure to send it "lon lat" not "lat lon"
# - if you send cs2cs a third data column, beware it might be treated as "z"
+# todo:
+# - `cut` away x,y columns into a temp file, feed to cs2cs, then `paste`
+# back to input file. see method in v.in.garmin.sh. that way additional
+# numeric and string columns would survive the trip, and 3rd column would
+# not be modified as z.
#%Module
#% description: Converts coordinates from one projection to another (cs2cs frontend).
@@ -71,6 +76,9 @@
#% key: d
#% description: Output long/lat in decimal degrees or other projections with many decimal places
#%end
+#% key: e
+#% description: Include input coordinates in output file
+#%end
import sys
import os
@@ -85,6 +93,7 @@
ll_in = flags['i']
ll_out = flags['o']
decimal = flags['d']
+ copy_input = flags['e']
#### check for cs2cs
if not grass.find_program('cs2cs'):
@@ -181,12 +190,16 @@
outfmt = []
else:
outfmt = ["-f", "%.8f"]
+ if not copy_input:
+ copyinp = []
+ else:
+ copyinp = ["-E"]
#### do the conversion
# Convert cs2cs DMS format to GRASS DMS format:
# cs2cs | sed -e 's/d/:/g' -e "s/'/:/g" -e 's/"//g'
- cmd = ['cs2cs'] + outfmt + in_proj.split() + ['+to'] + out_proj.split()
+ cmd = ['cs2cs'] + copyinp + outfmt + in_proj.split() + ['+to'] + out_proj.split()
p = grass.Popen(cmd, stdin = grass.PIPE, stdout = grass.PIPE)
while True:
More information about the grass-commit
mailing list