Hi,

Giacomo Piva wrote:
Giacomo Piva wrote:
[...]

I should convert a shapefile into a raster file (GeoTIFF format) at a given resolution and I want to use the GRASS modules as a command line tools. I followed the instructions in the chapter "Automated usage of grass" in the Markus's book and I created a bash script in order to prepare the grass enviroment:

#!/bin/bash
LOCATION=test

GISBASE=/usr/local/grass-6.5.svn
GISDBASE=/usr/local/share/grassdata

rm $HOME/.grassrc6
rm -rf "$GISDBASE/$LOCATION" #cleaning LOCATION

TMPDIR=$$.tmp
mkdir -p $GISDBASE/$TMPDIR/temp

echo "LOCATION_NAME: $TMPDIR" > $HOME/.grassrc6
echo "MAPSET: temp" >> $HOME/.grassrc6
echo "DIGITIZER: none" >> $HOME/.grassrc6
echo "GISDBASE: $GISDBASE" >> $HOME/.grassrc6

export GISBASE=$GISBASE
export GISRC=$HOME/.grassrc6
export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts

After these lines I run the v.in.ogr module to import the vector:
v.in.ogr -o -e dsn=./test_data/test_data.shp output=grass_map
According to the grass book, the v.in.ogr command should include the location option: v.in.ogr -o -e dsn=./test_data/test_data.shp output=grass_map location=$LOCATION

then go to the newly created location (set the environment variables accordingly and update .grassrc6), set the region extends and resolution to your demands, run v.to.rast, then r.out.gdal.

IMHO, it is easier to use the GUI.

Hope that helps,

Markus M

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

Reply via email to