[GRASS-SVN] r34053 - grass/branches/develbranch_6/scripts/d.out.file

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 29 08:18:18 EDT 2008


Author: hamish
Date: 2008-10-29 08:18:18 -0400 (Wed, 29 Oct 2008)
New Revision: 34053

Modified:
   grass/branches/develbranch_6/scripts/d.out.file/d.out.file
Log:
geotiff: chop off white borders. problems: will wreck any at=percent placement and multiframes?

Modified: grass/branches/develbranch_6/scripts/d.out.file/d.out.file
===================================================================
--- grass/branches/develbranch_6/scripts/d.out.file/d.out.file	2008-10-29 11:39:38 UTC (rev 34052)
+++ grass/branches/develbranch_6/scripts/d.out.file/d.out.file	2008-10-29 12:18:18 UTC (rev 34053)
@@ -345,6 +345,7 @@
 fi
 
 d.mon start=$GRAPHICS_DRIVER --quiet
+BOX=`d.info -b | cut -f2 -d':'`
 eval "$dsave"
 d.mon stop=$GRAPHICS_DRIVER --quiet
 ################################
@@ -395,7 +396,17 @@
      ;;
    geotiff)
      g.message "Translating to GeoTIFF format" 
-     eval `d.info -g`
+     eval `g.region -g`
+
+     # chop off out of region borders 
+     BOX_L=`echo $BOX | cut -f1 -d' '`
+     BOX_R=`echo $BOX | cut -f2 -d' '`
+     BOX_T=`echo $BOX | cut -f3 -d' '`
+     BOX_B=`echo $BOX | cut -f4 -d' '`
+     BOX_WIDTH=`echo $BOX_R $BOX_L | awk '{print $1 - $2}'`
+     BOX_HEIGHT=`echo $BOX_B $BOX_T | awk '{print $1 - $2}'`
+     g.message "Image crop [$BOX_WIDTH x $BOX_HEIGHT]"
+
      PROJ_WKT="`g.proj -wf`"
      CO=""
      if [ -n "$GIS_OPT_CREATEOPT" ] ; then
@@ -414,6 +425,7 @@
      unset IFS
 
      gdal_translate -of GTIFF -a_ullr $w $n $e $s -quiet \
+	-srcwin $BOX_L $BOX_T $BOX_WIDTH $BOX_HEIGHT \
 	-a_srs "$PROJ_WKT" $CO $MO "$output" "$outname"
      EXITCODE=$?
      ;;



More information about the grass-commit mailing list