On CentOs 7.. I installed GRASS by
yum install grass
So, using this great tutorial: https://xycarto.com/2020/05/03/basic-grass-gis-with-bash/ I try to get started with GRASS.
I made a folder GRASSDATA and then I made a bash script to initiate it: create a location and a mapset. But command
grass -text -c esri:102027 -e $GRASSDB/$GRASSLOC results in
The LOCATION "GRASSDATA" does not exist. Please create it first. In bash file I specified $GRASSDB and $GRASSLOC which are in other folder than I start grass from (but even if I change it to that folder it doesn't help at all).
Seems I don't understand some basic approach to GRASS. It starts a GRASS session, but doesn't create any location.
I understand that I can create location from GUI (on Windows, as I dont have any GUIs on Linux), but I would like to build the whole processing environment to dockerize it then.
I also analyzed this case enter link description here but I don't think I should specify paths to GRASS scripts as GRASS is launched successfully.
So, what steps should I take then to init GRASS from an empty folder GRASSDATA?
UPD: I added some path variables as proposes the example:
EXTENT=$DATA/extent.shp export GISBASE=/usr/lib64/grass export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib #(although I don't have such dir in grass dir.. GRASSDB="/mnt/GRASSDATA" GRASSLOC="MYLOCATION" mkdir -p "$GRASSDB/$GRASSLOC/PERMANENT" grass --text -c -e $EXTENT $GRASSDB/$GRASSLOC #(for this time I took a georeferenced file, not ESRI prj code, however it must be understood by grass.
And I got some errors again:
Starting GRASS ... /usr/lib64/grass-6.4.4/etc/Init.sh: line 537: [: !=: unary operator expected basename: invalid option -- 'e' Try 'basename --help' for more information. dirname: invalid option -- 'e' Try 'dirname --help' for more information. GISDBASE, LOCATION_NAME and MAPSET variables not set properly. Interactive startup needed.
Here the extent file I use to create a location
UPD2: by editing -e to --e I return to the first error mentioned - grass starts a session, but doesn't create any location, and it sees working folder as possible but not existing location.
I looked at the Init.sh code: there is no flag like -e.
I have grass 6.4.4 ver. And please hold in mind that I don't have grass installed with conda, only installed with yum install grass!
UPD3: before Starting GRASS it wrote me:
WARNING: Searched for a web browser, but none found. WELCOME TO GRASS Version 6.4.4 2014 1) Have at your side all available GRASS GIS tutorials 2) When working on your location, the following materials are extremely useful: - A topographic map of your area - Current catalog of available computer maps 3) Check the GRASS GIS web pages for supporting mailing lists and more: http://grass.osgeo.org Hit RETURN to continue
Not like on Micha's computer - Start GRASS and then immediately it created LOCATION
My last code was:
grass -text -c $EXTENT .$GISDBASE
where EXTENT is a path to extent.shp and GISDBASE is a name of DB folder