User Tools

Site Tools


wiki:grasscreatelocation

GRASS Create Location using ancillary layer

Execute GRASS commands while beeing in GRASS

Create a location in a new grass database using a referenced dataset.

Create a new GrassDataBase and copy the input.tif

rm -rf ~/ost4sem/grassdbnew/
mkdir ~/ost4sem/grassdbnew/
cp ~/ost4sem/exercise/basic_adv_gdalogr/input.tif ~/ost4sem/grassdbnew/input.tif

Define a projection to the input.tif

cd ~/ost4sem/grassdbnew/
gdalwarp   -t_srs EPSG:4326  -s_srs EPSG:4326  input.tif input_proj.tif

Run the grass74 command which creates the newlocation based on the input_proj.tif

rm -rf ~/ost4sem/grassdbnew/newlocation
grass74 -text -c input_proj.tif newlocation ~/ost4sem/grassdbnew 
r.in.gdal input=input_proj.tif  output=input_proj

import the date

for file in *.tif 
filename=$(basename $file .tif)
r.in.gdal input=$file.tif  output=$file
done

Execute GRASS commands from BASH without enter in GRASS

cd ~/ost4sem/grassdbnew/
rm -rf ~/ost4sem/grassdbnew/newlocation
grass74 -text -c input_proj.tif  -e ~/ost4sem/grassdbnew/newlocation 
grass74 ~/ost4sem/grassdbnew/newlocation/PERMANENT/ --exec r.external input=input_proj.tif  output=input_proj
grass74 ~/ost4sem/grassdbnew/newlocation/PERMANENT/ --exec r.info input_proj
wiki/grasscreatelocation.txt · Last modified: 2019/05/16 12:54 (external edit)