[GRASS-user] Original location: Hot to create from the command line ?

"Peter Löwe" peter.loewe at gmx.de
Tue Jan 20 05:46:23 EST 2009



> >> > To be precise: If GRASS is started for the first time in "-text" mode
> >> > (=no GUI) ** without having a sample location like Spearfish or North
> >> > Carolina around**, how can location parameters (projection, extent,
> >> > EPSG...) be handed over to set up a very first location ?
> >>
> >> Just type in the name of the location you want to create and GRASS will
> >> prompt you for the parameters.
> >>
> >> Moritz
> >
> > That's true. But is there also a way to provide the parameters _without_
> interaction
> > with the user (-> GRASS scripting & automation) ?
> 
> Sure.
> An older version of a shell script is here:
>  http://www.grassbook.org/examples_menu2nd.php
>  -> create_location.sh
> 
> Keeping in mind
> http://grass.osgeo.org/wiki/GRASS_and_Shell#GRASS_Batch_jobs
> it should be even easier to write it.
> 
> Markus

Well, there seem still to be some issues to be dealt with:

I am defining all basic requirements for a location and GRASS session:

  #generate folders for temporal LOCATION and MAPSET
  mkdir -p $CURRENT_DIR/$THE_LOCATION/$THE_MAPSET

  #Set up a temporary grassrc-File:
  echo "GISDBASE: $CURRENT_DIR
  LOCATION_NAME: $THE_LOCATION
  MAPSET: $THE_MAPSET
  " > $TMPDIR/$THE_GRASSRC

 # Lets export the variables:
  export GISBASE=/opt/grass
  export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib

  # use process ID (PID) as lock file number:
  export GIS_LOCK=$$

The steps described so far (should) be sufficient to define a GRASS session, with newly created directories for the location and mapset.

Until this point, no information has been provided about the projection parameters.

This should be handled by the following commands:
g.proj -p                                 [to see what the (default ?) project is]
g.proj -c epsg=4326              [to override the projection information]
g.region -s  n=90 s=-90 w=-180 e=180 res=1 [to define the default (-> -s flag) region]
g.region -p                                                        [to check the results]

Unfortunately this results in:
ERROR: default region is not set
ERROR: default region is not set
ERROR: default region is not set
ERROR: default region is not set

What's missing ?

Peter



-- 
Dr. Peter Löwe
<peter.loewe at gmx.de>





Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger


More information about the grass-user mailing list