On Jan 20, 2009, at 9:00 AM, Paul Kelly wrote:

On Tue, 20 Jan 2009, "Peter Löwe" wrote:

Hi,

here is a working (bash-)scripting approach on how to conjure up a minimalistic xy-location out of thin air and to transmogrify the projection (f.e. EPSG:4326):

It doesn't really need to be so long though - in recent versions of GRASS g.proj doesn't require a dummy location in order to run. This should do it almost as well:

###################################################################################
## LOCATION SETUP PREPARATION (FILESYSTEM)

##################################################################################
#Set up a temporary grassrc-File:

echo "GISDBASE: $CURRENT_DIR
" > $TMPDIR/$THE_GRASSRC

#################################################################################
# Export paths to GRASS binaries and libraries:

export GISBASE=/opt/grass

Maybe pick it up from an exported GISBASE in the shell? - to accomodate different install locations.


export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib

Also note that this should be DYLD_LIBRARY_PATH for OSX. Maybe something could be used from init.sh:

SYSTEM=`uname -s`
case $SYSTEM in
Darwin*)
        MACOSX=1
        ;;
esac

if [ "$MACOSX" ] ; then
if [ ! "$DYLD_LIBRARY_PATH" ] ; then
  DYLD_LIBRARY_PATH="$GISBASE/lib"
else
  DYLD_LIBRARY_PATH="$GISBASE/lib:$DYLD_LIBRARY_PATH"
fi
else
if [ ! "$LD_LIBRARY_PATH" ] ; then
  LD_LIBRARY_PATH="$GISBASE/lib"
else
  LD_LIBRARY_PATH="$GISBASE/lib:$LD_LIBRARY_PATH"
fi
fi




g.proj -c epsg=4326 location=$THE_LOCATION

Another idea: take the projection option as a script argument. It could be any of the valid g.proj options, something like (say the script is "createloc"):

createloc epsg=4326

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

Theory of the Universe

There is a theory which states that if ever anyone discovers exactly what the universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarrely inexplicable. There is another theory which states that this has already happened.

-Hitchhiker's Guide to the Galaxy 2nd season intro


_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to