Esportare modelli digitali del terreno da grass in formato compatibile con ossim-ossimplanet
Da Wikipedia, l'enciclopedia libera.
r.out.planet - Grass-Script per l'esportazione di DEM (digital elevation model) in formato SRTM leggibile da OSSIMPLANET
#!/bin/sh
############################################################################
#
# MODULE: r.out.planet
#
# AUTHOR(S): Di Stefano Massimo
#
#
# PURPOSE: convert elevation data from grass mapset to ossim srtm data
#
#
# COPYRIGHT: (c) 2006 by 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.
#
# REQUIRES: OSSIM (OpenSource-Software-Image-Mapping)
#
#
#############################################################################
#%Module
#% description: convert elevation data from grass mapset to ossim srtm data
#%End
#%option
#% key: elevation
#% type: string
#% gisprompt: old,cell,raster
#% description: Input elevation data
#% required: yes
#%end
#%option
#% key: tiling
#% type: double
#% description: tiling size
#% required : yes
#%end
#%option
#% key: directory
#% type: string
#% gisprompt: new_file,file,output
#% description: directory where save output
#% required : yes
#%end
#%option
#% key: name
#% type: string
#% description: nome elevation export
#% required : yes
#%end
directory=$GIS_OPT_directory
elevation=$GIS_OPT_elevation
name=$GIS_OPT_name
tiling=$GIS_OPT_tiling
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
### setup enviro vars ###
eval `g.gisenv`
: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
LOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET
#create directory to store the output
mkdir $directory
cd $directory
mkdir srtm_elevation
PROG=`basename $0`
# Controlla se orthoigen è nel path
for i in `echo $PATH | sed 's/^:/.:/
s/::/:.:/g
s/:$/:./
s/:/ /g'`
do
if [ -f $i/orthoigen ] ; then
# Save the path of the grass60 command
# Use the first one in user's path
break
fi
done
g.region save=region.saved
g.region rast=$elvation -a
#
#eval $( r.info $elevation -s )
#tiling="`echo \"( (108000+$nsres)/$nsres )\"|bc `"
#
r.out.gdal input=$elevation format=GTiff type=Float32 output=$name
g.region region.saved
g.remove region=region.saved
echo "
//
igen.slave_tile_buffers: 5
igen.tiling.type: ossimTiling
igen.tiling.tiling_distance: 1 1
igen.tiling.tiling_distance_type: degrees
// for 5 meters use tiling = 21601 21601
// for 10 meters use tiling = 10801 10801
// for 30 meters use tiling = 3601 3601
// for 90 meters use tiling = 1201 1201
igen.tiling.delta: $tiling $tiling
igen.tiling.delta_type: total_pixels
//igen.tiling.tile_name_mask: %SRTM%
igen.tiling.padding_size_in_pixels: 0 0
object1.description:
object1.enabled: 1
object1.id: 1
object1.object1.description:
object1.object1.enabled: 1
object1.object1.id: 2
object1.object1.resampler.magnify_type: bilinear
object1.object1.resampler.minify_type: bilinear
object1.object1.type: ossimImageRenderer
object1.object2.type: ossimCastTileSourceFilter
object1.object2.scalar_type: ossim_sint16
object1.type: ossimImageChain
object2.type: ossimGeneralRasterWriter
object2.byte_order: big_endian
object2.create_overview: false
object2.create_histogram: false
object2.create_external_geometry: false
product.projection.type: ossimEquDistCylProjection
" > orthoigen_srtm.kwl
orthoigen --tiling-template ./orthoigen_srtm.kwl --view-template ./orthoigen_srtm.kwl --writer-template ./orthoigen_srtm.kwl --chain-template ./orthoigen_srtm.kwl $name srtm_elevation/%SRTM%
--Epifanio 19:39, Apr 24, 2007 (CEST)Massimo Di Stefano

