[GRASS-SVN] r73770 - grass-addons/grass7/vector/v.out.png

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 5 08:20:39 PST 2018


Author: neteler
Date: 2018-12-05 08:20:39 -0800 (Wed, 05 Dec 2018)
New Revision: 73770

Modified:
   grass-addons/grass7/vector/v.out.png/v.out.png.html
   grass-addons/grass7/vector/v.out.png/v.out.png.py
Log:
v.out.png addon: world file support added

Modified: grass-addons/grass7/vector/v.out.png/v.out.png.html
===================================================================
--- grass-addons/grass7/vector/v.out.png/v.out.png.html	2018-12-05 12:39:10 UTC (rev 73769)
+++ grass-addons/grass7/vector/v.out.png/v.out.png.html	2018-12-05 16:20:39 UTC (rev 73770)
@@ -1,21 +1,29 @@
 <h2>DESCRIPTION</h2>
 
-<em>v.out.png</em> exports a GRASS vector map in non-georeferenced PNG image
-format, respecting the current region resolution and bounds.
+<em>v.out.png</em> exports a GRASS vector map in non-georeferenced
+Portable Network Graphics (PNG) image format, respecting the current
+region resolution and bounds.
 
 By default it look for a color table, set using <a href="v.colors.html">v.colors</a>
 you can also set the attribute table where read the feature color.
 
+<p>
+Optionally the user can choose to export a World File (.wld) to provide basic
+georeferencing support using the <b>-w</b> flag.
+
 <h2>SEE ALSO</h2>
 
 <em>
 <a href="r.out.png.html">r.out.png</a>,
-<a href="v.colors.html">v.colors</a>,
-<a href="r.out.tiff.html">r.out.tiff</a>,
-<a href="r.out.ascii.html">r.out.ascii</a>,
-<a href="r.in.png.html">r.in.png</a>
+<a href="r.out.gdal.html">r.out.gdal</a>,
+<a href="r.in.png.html">r.in.png</a>,
+<a href="v.colors.html">v.colors.png</a>
 </em>
 
 
 <h2>AUTHORS</h2>
+
 Luca Delucchi<br>
+World file support by Anika Bettge and Markus Neteler
+
+<p><i>Last changed: $Date$</i>

Modified: grass-addons/grass7/vector/v.out.png/v.out.png.py
===================================================================
--- grass-addons/grass7/vector/v.out.png/v.out.png.py	2018-12-05 12:39:10 UTC (rev 73769)
+++ grass-addons/grass7/vector/v.out.png/v.out.png.py	2018-12-05 16:20:39 UTC (rev 73770)
@@ -50,6 +50,10 @@
 #% label: Height of PNG file
 #% answer: 480
 #%end
+#%flag
+#%key: w
+#%description: Output world file
+#%end
 
 import os
 import sys
@@ -81,7 +85,20 @@
     if monitor_old:
         g.gisenv(set='MONITOR=%s' % monitor_old)
 
+    # get computational region info
+    win = grass.region()
 
+    if flags['w']:
+        wldfile = options['output'].split('.')[0] + '.wld'
+        file_ = open(wldfile, "w")
+        file_.write("%36.15f \n" % win['ewres'])
+        file_.write("%36.15f \n" % 0.0)
+        file_.write("%36.15f \n" % 0.0)
+        file_.write("%36.15f \n" % (-1 * win['nsres']))
+        file_.write("%36.15f \n" % (win['w'] + win['ewres'] / 2.0))
+        file_.write("%36.15f \n" % (win['n'] - win['nsres'] / 2.0))
+        file_.close()
+
 if __name__ == "__main__":
     options, flags = grass.parser()
     sys.exit(main())



More information about the grass-commit mailing list