[GRASS-SVN] r42064 - grass-addons/ossim_grass/r.planet

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Apr 30 07:10:54 EDT 2010


Author: epifanio
Date: 2010-04-30 07:10:53 -0400 (Fri, 30 Apr 2010)
New Revision: 42064

Modified:
   grass-addons/ossim_grass/r.planet/description.html
   grass-addons/ossim_grass/r.planet/r.planet.py
Log:
added flags to handle mpi, improved description.

Modified: grass-addons/ossim_grass/r.planet/description.html
===================================================================
--- grass-addons/ossim_grass/r.planet/description.html	2010-04-29 21:56:53 UTC (rev 42063)
+++ grass-addons/ossim_grass/r.planet/description.html	2010-04-30 11:10:53 UTC (rev 42064)
@@ -1,12 +1,48 @@
 <h2>DESCRIPTION</h2>
 
 
-<em><b>r.planet.py : </b></em> Scripts to : 
+<em><b>r.planet.py </b></em> 
 <p>
-- generate vrt layer from a selected grass raster layer and add/zoomTo/remove the data from/to ossimplanet using the ossimplanet tcp listner.
+- Generate vrt layer from a selected grass raster layer and add/zoomTo/remove the data from/to ossimplanet using the ossimplanet tcp listner.
 <p>
-- generate ossimplanet 3d tiles from elevation data.
+- Generate ossimplanet 3d tiles from elevation data.
+<p>
+As default the module uses :  host = 'localhost', pport = 7000, dport = 8000
+<p>
+The module will generate VRT data inside the directory : $MAPSET/vrt/raster  and $MAPSET/vrt/raster/elevetion.
+<p>
+Using the flag "-d" if non name is selected (parameter : elev) the module will use the map's name.
 
+
+<h2>Flags:</h2>
+
+<em><b>-a </b></em> : Add selected map to Ossimplanet
+<p>
+<em><b>-r </b></em> : Remove selected map to Ossimplanet
+<p>
+<em><b>-d </b></em> : Generate 3d Tiles
+<p>
+<em><b>-m </b></em> : Use Open MPI
+
+<h2>Parameters</h2> :
+<p>
+<em><b>map </b></em> : Input map
+<p>
+<em><b>Host </b></em> : Ossimplanet listener IP 
+<p>
+<em><b>dport </b></em> : Ossimplanet listener port to receive position messages
+<p>
+<em><b>pport </b></em> : Ossimplanet listener port to receive datasource
+<p>
+<em><b>np </b></em> : Number of MPI processors
+<p>
+<p>
+<em><b>tile </b></em> : tiles dimension for 3d data
+<p>
+<p>
+<em><b>elev </b></em> : Name for the exporeted elevation
+<p>
+
 <h2>EXAMPLE</h2>
 
 Add selected map to ossimplanet screen and zoom to it :

Modified: grass-addons/ossim_grass/r.planet/r.planet.py
===================================================================
--- grass-addons/ossim_grass/r.planet/r.planet.py	2010-04-29 21:56:53 UTC (rev 42063)
+++ grass-addons/ossim_grass/r.planet/r.planet.py	2010-04-30 11:10:53 UTC (rev 42064)
@@ -71,6 +71,13 @@
 #% description: tile
 #% required : no
 #%end
+#%option
+#% key: elev
+#% type: string
+#% key_desc: elevation name
+#% description: elevation name
+#% required : no
+#%end
 #%flag
 #% key: a
 #% description: Add raster
@@ -97,6 +104,8 @@
 import platform
 
 def main():
+    global mpi
+    global np
     add = flags['a']
     remove = flags['r']
     orthoigen = flags['d']
@@ -105,6 +114,7 @@
     dport = options['dport']
     pport = options['pport']
     tile = options['tile']
+    elev = options['elev']
     np = options['np']
     grassenv = grass.gisenv()
     mappa = options['map'].replace("@"," ")
@@ -113,6 +123,7 @@
     nflags = len(filter(None, [add, remove, orthoigen]))
     if nflags > 1:
         grass.run_command('g.message' , message = 'Cannot add & remove a map or use orthoigen at the same time.')
+        sys.exit()
     if nflags < 1:
         grass.run_command('g.message' , message = 'No action requested , please choose one from "-a : add" or "-r : remove" flags.')
     try :
@@ -145,32 +156,34 @@
     lat = zoom_position[0]
     lon = zoom_position[1]
     distance = zoom_position[2]
-    if nflags == 1:
-        if add :
-            try :
-                addzoom(output,lon,lat,distance,host,dport,pport)
-                print 'Added raster file :', mappa[0]
-                print 'Camera positioned to : '
-                print 'Longitude = ',lon
-                print 'Latitude = ', lat
-                print 'Altitude = ' , distance
-            except :
-                print "conecction error"
-        if remove :
-            removefile(output,host,dport)
-            print 'Removed raster file :', mappa[0]
-        if orthoigen :
-            if tile != '':
-                path = os.path.dirname(output)
+    if add :
+        try :
+            addzoom(output,lon,lat,distance,host,dport,pport)
+            print 'Added raster file :', mappa[0]
+            print 'Camera positioned to : '
+            print 'Longitude = ',lon
+            print 'Latitude = ', lat
+            print 'Altitude = ' , distance
+        except :
+            print "conecction error"
+    if remove :
+        removefile(output,host,dport)
+        print 'Removed raster file :', mappa[0]
+    if orthoigen :
+        if tile != '':
+            path = os.path.dirname(output)
+            if elev == '':
                 elevdir = os.path.join(path,'elevation',mappa[0]+'/')
-                if not os.path.exists(elevdir):
-                    os.makedirs(elevdir)
-                    elev = mappa[0]+'.tiff'
-                    exportiff(output,elev)
-                    instr = make3d(tile, elev, elevdir)
-                    os.system(instr)
-                if tile == '':
-                    print 'please set the tile dimension'
+            else :
+                elevdir = os.path.join(path,'elevation',elev+'/')
+            if not os.path.exists(elevdir):
+                os.makedirs(elevdir)
+                elev = mappa[0]+'.tiff'
+                exportiff(output,elev)
+                instr = make3d(tile, elev, elevdir)
+                os.system(instr)
+            if tile == '':
+                print 'please set the tile dimension'
 
 def exportiff(infile,outfile):
     gdal.GetDriverByName('GTiff').CreateCopy(outfile,gdal.Open(infile))
@@ -355,16 +368,14 @@
 
 def makeoverview(input):
     systemplatform = WhichPlatform()
-    mpi = 0
-    np = 1
     if systemplatform == 'Darwin':
         img2rrexec = 'export DYLD_FRAMEWORK_PATH=/Users/sasha/OssimBuilds/Release/ ; /Users/sasha/OssimBuilds/Release/ossim-img2rr'
     else :
         img2rrexec = 'ossim-img2rr'
-    if mpi == 1 :
+    if mpi :
         os.system("mpirun -np %s %s %s" % (np, img2rrexec, input))
     else :
-        os.system('%s %s' % (img2rrexec, input))
+       os.system('%s %s' % (img2rrexec, input))
         
 
 



More information about the grass-commit mailing list