[GRASS-SVN] r49321 - grass/trunk/scripts/d.out.gpsdrive

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 21 21:08:31 EST 2011


Author: hamish
Date: 2011-11-21 18:08:31 -0800 (Mon, 21 Nov 2011)
New Revision: 49321

Removed:
   grass/trunk/scripts/d.out.gpsdrive/Makefile
   grass/trunk/scripts/d.out.gpsdrive/d.out.gpsdrive
   grass/trunk/scripts/d.out.gpsdrive/d.out.gpsdrive.html
Log:
I've no plans to port this to grass 7 at this point, and AFAIK I was the only one using it anyway. If it comes back, I'll probably make it an addons script

Deleted: grass/trunk/scripts/d.out.gpsdrive/Makefile
===================================================================
--- grass/trunk/scripts/d.out.gpsdrive/Makefile	2011-11-21 22:35:08 UTC (rev 49320)
+++ grass/trunk/scripts/d.out.gpsdrive/Makefile	2011-11-22 02:08:31 UTC (rev 49321)
@@ -1,7 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM = d.out.gpsdrive
-
-include $(MODULE_TOPDIR)/include/Make/Script.make
-
-default: script

Deleted: grass/trunk/scripts/d.out.gpsdrive/d.out.gpsdrive
===================================================================
--- grass/trunk/scripts/d.out.gpsdrive/d.out.gpsdrive	2011-11-21 22:35:08 UTC (rev 49320)
+++ grass/trunk/scripts/d.out.gpsdrive/d.out.gpsdrive	2011-11-22 02:08:31 UTC (rev 49321)
@@ -1,224 +0,0 @@
-#!/bin/sh
-#
-############################################################################
-#
-# MODULE:       d.out.gpsdrive
-#
-# AUTHOR(S):    M. Hamish Bowman
-#		Dept. Marine Science, University of Otago, New Zealand
-#
-# PURPOSE:      Export display monitor to a gpsdrive compatible image
-#
-# COPYRIGHT:    (c) 2005-2008 The GRASS Development Team
-#
-#               This program is free software under the GNU General Public
-#               License (>=v2). Read the file COPYING that comes with GRASS
-#               for details.
-#
-#############################################################################
-#
-# GpsDrive: http://www.gpsdrive.de
-#
-# REQUIREMENTS:
-#	- awk
-#	- d.info newer than 30 June 2006
-#	- pngtopnm and pnmtojpeg from NetPBM  http://netpbm.sourceforge.net
-#
-#############################################################################
-#
-# NOTES:
-#
-#  Output must be 1280x1024,  use PNG or JPEG
-#  You can figure out the "scale" factor by meters/pixel * 2817.947378
-#    2817 is maybe someones screen dpi converted to pixels/meter??
-#
-#  At scales wider than say 1:250,000 the curvatute of the Earth really starts
-#   to play havoc with GpsDrive's simple projection system if you are using
-#   a UTM or other non-lat/lon projection. Best to use output from a lat/lon
-#   location in that case. i.e. to avoid distortion, anything more global than
-#   1:150k to 1:500k should use "top_*".
-#
-# Beware  if you are using an image originating from a map projection with
-# a significant deviation between true  north  and  the  map  projection's
-# local  +y  direction  (known as the Convergence Angle). GpsDrive assumes
-# that true north is always directly up! i.e. the Central Meridian of  the
-# map projection is located at the map tile's center. For some map projec-
-# tions and areas of the country this can be a really bad  assumption  and
-# your  map  will be significantly rotated. This effect is most visible at
-# map scales covering a large area. This does not affect lat/lon maps.
-# The pnmrotate program may help, or gdalwarp to a custom map-centered tmerc.
-#
-# A series of 1:50,000 maps may not be so bad.
-#   This translates to approx a 22.7km x 18.2km image window in the GIS.
-#     x_ext=scale*(1280/2817.9)
-#  1:75,000 uses a region 34.1km x 27.3km.
-#  1:100,000 uses a region  45.4km x 36.3km.
-#  1:175,000 uses a region  80km across.
-#
-# HINTS:
-#  first get things ready in a 640x512 window (1/2 scale, same aspect ratio)
-#   export GRASS_WIDTH=640
-#   export GRASS_HEIGHT=512
-#   d.mon x0
-#
-#############################################################################
-
-
-#%Module
-#%  description: Export display monitor to a GpsDrive compatible backdrop image
-#%  keywords: display, export, GPS
-#%End
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new_file,file,output
-#% description: name for new map image (lives in ~/.gpsdrive/maps/)
-#% required : yes
-#%end
-#%flag
-#%  key: j
-#%  description: Make JPEG instead of PNG image
-#%end
-
-if [ -z "$GISBASE" ] ; then
-        echo "You must be in GRASS GIS to run this program."
-    exit 1
-fi
-
-if [ "$1" != "@ARGS_PARSED@" ] ; then
-  exec g.parser "$0" "$@"
-fi
-
-PROG=`basename $0`
-
-#### check if we have awk
-if [ ! -x "`which awk`" ] ; then
-    g.message -e "awk required, please install awk/gawk first" 
-    exit 1
-fi
-
-#### check if we have NetPBM
-if [ "$GIS_FLAG_J" -eq 1 ] ; then
-  if [ ! -x "`which pngtopnm`" ] || [ ! -x "`which pnmtojpeg`" ] ; then
-    g.message -e "NetPBM tools are required for JPEG output"
-    exit 1
-  fi
-fi
-
-# set environment so awk works properly in all languages
-unset LC_ALL
-LC_NUMERIC=C
-export LC_NUMERIC
-
-
-if [ ! -d "$HOME/.gpsdrive/maps" ] ; then
-    mkdir -p "$HOME/.gpsdrive/maps"
-fi
-
-# GpsDrive scales maps named top_* as lat/lon (1:1) on-screen
-# GpsDrive scales maps named map_* as UTM-like (1:cos(lat) ) on-screen
-PROJ=`g.region -p | grep ^proj | cut -f2 -d' '`
-if [ "$PROJ" -eq 3 ] ; then
-   IS_LATLON=1
-   TYPE="top"
-else
-   IS_LATLON=0
-   TYPE="map"
-   if [ "$PROJ" -ne 1 ] ; then
-      g.message message="GpsDrive assumes northings are not rotated compared "\
-"to true-geographic north. If you are using a projection with significant "\
-"curvature away from the central meridian, then you will likely end up with "\
-'a distorted background map! '\
-"Keeping the area small will lessen the error, but not eliminate it. "\
-"Consider output from a Lat/Lon location if the convergence angle is "\
-"more than a couple of degrees."
-      g.region -n
-
-	# TODO: add a flag to correct for convergence angle with pnmrotate
-   fi
-fi
-
-GRASS_TRUECOLOR=TRUE
-export GRASS_TRUECOLOR
-GRASS_WIDTH=1280
-export GRASS_WIDTH
-GRASS_HEIGHT=1024
-export GRASS_HEIGHT
-
-# get rid of no or double extension
-output="${TYPE}_`basename $GIS_OPT_OUTPUT .png`.png"
-
-GRASS_PNGFILE="$HOME/.gpsdrive/maps/$output"
-export GRASS_PNGFILE
-
-# As .jpg output will overwrite .png of the same name, we check,
-if [ -e "$GRASS_PNGFILE" ] ; then
-    g.message -e "Output image of that name (or base name) already exists."
-    exit 1
-fi
-
-
-# Check the current status of the monitor
-monitorcheck="`d.mon -p | grep 'No monitor'`"
-if  [ -n "$monitorcheck" ] ; then
-  g.message "No display monitor selected."
-  exit 1
-fi
-
-# check to see we have a new enough version of d.info
-d.info -b  1> /dev/null 2> /dev/null
-if [ $? -ne 0 ] ; then
-  g.message -e "Need a newer version of GRASS."
-  exit 1
-fi
-
-curr_mon=`d.mon -p | awk '{printf "%s", $4}'`
-
-#export display to PNG driver
-dsave=`d.save -a`
-d.mon start=PNG --quiet
-  FRAME_DIMS="`d.info -b | cut -f2- -d' '`"
-  eval "$dsave"
-d.mon stop=PNG --quiet
-#reset
-sleep 1
-d.mon select="$curr_mon"
-
-if [ "$GIS_FLAG_J" -eq 1 ] ; then
-   out_jpeg="`basename $output .png`.jpg"
-   cd "$HOME/.gpsdrive/maps/"
-   sync  # sleep 1
-   pngtopnm "$output" | pnmtojpeg > "$out_jpeg"
-   rm -f "$output"
-   output="$out_jpeg"
-fi
-
-eval `g.region -g`
-
-FRAME_WIDTH="`echo $FRAME_DIMS | awk '{printf("%f", $2 - $1)}'`"
-FRAME_HEIGHT="`echo $FRAME_DIMS | awk '{printf("%f", $4 - $3)}'`"
-
-if [ $IS_LATLON -eq 0 ] ; then
-   LAT=`g.region -lg | grep 'center_lat' | cut -f2 -d'='`
-   LON=`g.region -lg | grep 'center_long' | cut -f2 -d'='`
-
-   M_PER_PIXEL=`echo $e $w $FRAME_WIDTH | awk '{printf("%f", ($1 - $2) / $3)}'`
-else
-   LAT=`g.region -cg | grep 'northing' | cut -f2 -d'='`
-   LON=`g.region -cg | grep 'easting' | cut -f2 -d'='`
-
-   EXTENT=`g.region -eg | grep 'ns_extent' | cut -f2 -d'='`
-   M_PER_PIXEL=`echo $EXTENT $FRAME_HEIGHT | awk '{printf("%f", ($1 * 1852*60.) / $2)}'`
-fi
-
-SCALE=`echo $M_PER_PIXEL | awk '{printf("%d", 0.5 + ($1 * 2817.947378) )}'`
-
-if [ $IS_LATLON -eq 0 ] && [ "$SCALE" -ge 125000 ] ; then
-   g.message -w "Projected input maps may be somewhat inaccurate at this scale. Better to use lat/lon"
-fi
-
-echo "$output $LAT $LON $SCALE" >> "$HOME/.gpsdrive/maps/map_koord.txt"
-
-g.message -v "Center lat,lon is [$LAT,$LON],  scale is [1:${SCALE}]"
-
-g.message "Done."

Deleted: grass/trunk/scripts/d.out.gpsdrive/d.out.gpsdrive.html
===================================================================
--- grass/trunk/scripts/d.out.gpsdrive/d.out.gpsdrive.html	2011-11-21 22:35:08 UTC (rev 49320)
+++ grass/trunk/scripts/d.out.gpsdrive/d.out.gpsdrive.html	2011-11-22 02:08:31 UTC (rev 49321)
@@ -1,138 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>d.out.gpsdrive</em> exports the current GRASS display monitor to a 
-<a href="http://www.gpsdrive.de">GpsDrive</a> compatible backdrop 
-image and updates the GpsDrive image list with the appropriate geo-referencing
-information.
-
-<p><b><em>Use at your own risk. Do not use as a primary means of navigation.
-This software comes with absolutely no warranty.</em></b>
-
-
-<p><h2>NOTES</h2>
-
-Maps are saved in the user's <tt>~/.gpsdrive/maps/</tt> directory.
-Geo-referencing information is added to the user's
-<tt>~/.gpsdrive/maps/map_koord.txt</tt> file.
-
-<p>JPEG output requires the <tt>pngtopnm</tt> and <tt>pnmtojpeg</tt> programs
-from the <a href="http://netpbm.sourceforge.net">NetPBM tools</a>.
-
-<p>GpsDrive assumes northings are not rotated compared to true-geographic north.
-If you are using a projection with significant curvature away from the central
-meridian, or a map datum with a significant rotational component, then you will 
-likely end up with a distorted or inexact background map!
-Keeping the area small will lessen the error, but not eliminate it, if
-necessary you could reproject the map into a custom projection (such as tmerc)
-centered directly on the center of your map. You can check the local
-convergence angle (difference between grid north and true north) with
-"<tt>g.region -n</tt>".
-<p>To avoid distortion, anything more global than 1:150k to 1:500k
-should come from a lat/lon location. Anything more local than that
-will look better coming from a projected system such as UTM.
-<p>The extent of a map given a target scale can be calculated with 
-<tt>x_ext=scale*(1280/2817.95)</tt>. e.g. 1:50,000 translates to approx
-a 22.7km x 18.2km image window in the GIS.
-<p>For your convenience (calculations are rough, but nominal):
-<div class="code"><pre>
-1:50,000 uses a region 22.7km x 18.2km.
-1:75,000 uses a region 34.1km x 27.3km.
-1:100,000 uses a region  45.4km x 36.3km.
-1:175,000 uses a region  79.5km x 63.6km.
-</pre></div>
-<br>
-
-
-Maps exported from lat-lon locations will be given a "<tt>top_</tt>" prefix.
-Maps exported from locations of other projections will be given a 
-"<tt>map_</tt>" prefix. This is done so GpsDrive knows how to scale the 
-image correctly.
-<p>GpsDrive requires backdrop images to be 1280x1024 pixels in size. While this
-script takes care of that automatically, to avoid annoying bands on the sides
-of your image you may want to set up your display monitor at half-scale (same
-aspect ratio) and use d.zoom to select the full frame. For example:
-<p><div class="code"><pre>
-export GRASS_WIDTH=640
-export GRASS_HEIGHT=512
-d.mon wx0
-</pre></div>
-
-<br>
-Map scaling is set from the region settings so should work correctly even 
-when the display's aspect ratio does not match that of the output image.
-
-
-<h3>Batch export</h3>
-
-It may be desirable to create a series of image tiles covering a large area.
-An easy way to do this is to run <em>d.out.gpsdrive</em> in a shell loop.
-Here is an example Bash script contributed by Manuel Morales:
-<p><div class="code"><pre>
-#!/bin/bash
-
-# map scale is determined by "panels" by dividing the N-S
-# region extent into that number of maps. Note that the
-# generated maps overlap by 1/2 along the N-S axis and by
-# approximately 1/2 along the E-W axis.
-panels=3
-iter=$((panels*2-1))
-
-eval `g.region -eg`
-eval `g.region -g`
-north=$n
-south=$s
-west=$w
-east=$e
-
-unit_ns=$(echo "scale=8; $ns_extent / $panels" | bc)
-unit_ew=$(echo "scale=8; $unit_ns * 4/3" | bc)
-
-panels_ew=$(echo "((2*$ew_extent / $unit_ew +.5 ) -1) / 1" | bc)
-
-for i in `seq 1 $panels_ew`;
-do
-  east=$(echo "scale=8; $west+$unit_ew" | bc)
-  for j in `seq 1 $iter`;
-    do
-    g.region n=$(echo "scale=8; $north-($j-1) * $unit_ns/2" | bc)      \
-        s=$(echo "scale=8; $north-($j-1) * $unit_ns/2-$unit_ns" | bc ) \
-        w=$west e=$east ewres=$ewres nsres=$nsres
-        d.redraw
-        d.out.gpsdrive -j tile_${i}_${j}
-    done
-  shift_west=$(echo "scale=8; ($ew_extent-$unit_ew)/($panels_ew-1)" | bc)
-  west=$(echo "scale=8; $west+$shift_west" | bc)
-done
-</pre></div>
-
-<br>
-Note that to get a smoother transition between backdrop maps this script
-creates overlapping tiles. For best results at least 1/3rd overlap should
-be maintained.
-
-
-<br><br>
-<h2>SEE ALSO</h2>
-
-<em><a href="d.info.html">d.info</a></em>,
-<em><a href="d.grid.html">d.grid</a></em>,
-<em><a href="d.out.file.html">d.out.file</a></em>,
-<em><a href="d.out.png.html">d.out.png</a></em>,
-<em><a href="d.save.html">d.save</a></em>,
-<em><a href="g.region.html">g.region</a></em>,
-<em><a href="v.in.garmin.html">v.in.garmin</a></em>
-<br><br>
-The GRASS <a href="pngdriver.html">PNG driver</a><br>
-
-The <a href="http://www.gpsdrive.de">GpsDrive</a> project<br>
-The <a href="http://gpsd.berlios.de">gpsd</a> personal GPS server project
-<br><br>
-
-<h2>AUTHOR</h2>
-Hamish Bowman<br> <i>
-Department of Marine Science<br>
-University of Otago<br>
-New Zealand</i><br>
-<br>
-
-<p><i>Last changed: $Date$</i>



More information about the grass-commit mailing list