[GRASS-SVN] r33990 - grass-addons/raster/r.viewshed

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 23 05:08:00 EDT 2008


Author: neteler
Date: 2008-10-23 05:08:00 -0400 (Thu, 23 Oct 2008)
New Revision: 33990

Added:
   grass-addons/raster/r.viewshed/testscript.sh
Log:
test case for r.viewshed

Added: grass-addons/raster/r.viewshed/testscript.sh
===================================================================
--- grass-addons/raster/r.viewshed/testscript.sh	                        (rev 0)
+++ grass-addons/raster/r.viewshed/testscript.sh	2008-10-23 09:08:00 UTC (rev 33990)
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Test script for r.viewshed based on a synthetic DEM
+# RUN THIS IS ANY GRASS LOCATION, e.g. NC or Spearfish
+
+# create first hemisphere
+g.region n=1000 s=0 w=0 e=1000 -p res=1
+r.mapcalc 'disk.15031=if(sqrt((col() - 500)^2 + (500 -
+row())^2)<500,sqrt((col() - 500)^2 + (500 - row())^2),null())'
+r.mapcalc 'hemisphere1=500 * sin(acos (disk.15031/500))'
+
+# create second hemisphere
+g.region n=500 s=0 w=0 e=500 -p res=1
+r.mapcalc 'disk.14947=if(sqrt((col() - 500)^2 + (500 -
+row())^2)<500,sqrt((col() - 500)^2 + (500 - row())^2),null())'
+r.mapcalc 'hemisphere2=500 * sin(acos (disk.14947/500))'
+g.remove --q rast=disk.14947,disk.15031
+# merge both
+r.mapcalc "hemisphere=hemisphere1 + hemisphere2"
+
+d.mon x0
+d.rast hemisphere
+
+# run r.viewshed
+r.viewshed hemisphere out=hemisphere_viewshed coord=250,250
+max=1000000 obs=100 mem=2000 --o
+r.shaded.relief hemisphere --o
+d.his h=hemisphere_viewshed i=hemisphere.shade
+
+# compare to r.los
+r.los hemisphere out=hemisphere_los coord=250,250 max=1000000 obs=100 --o
+d.mon x1
+d.his h=hemisphere_los i=hemisphere.shade
+
+nviz hemisphere col=hemisphere_viewshed


Property changes on: grass-addons/raster/r.viewshed/testscript.sh
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:eol-style
   + native



More information about the grass-commit mailing list