How to Quickstart GRASS

This chapter aims at giving a newcomer in GRASS a very hands-on introduction in order to give him the opportunity to very quickly take first tentative steps in GRASS. This does not replace a throrough study of the rest of the documentation, but should help relieve the frustrations that many newbies feel at the first contact with GRASS. It will cover GRASS 6.0, so if you have an earlier version, consider upgrading.

This introduction assumes that you have already successfully installed GRASS, but that you have not yet launched a GRASS session successfully. If you haven't installed GRASS, yet, please have a look at the chapter called Download and Install. For newbies, the binary installation is recommended. If you are unfamiliar with the UNIX or GNU/Linux environment, please go to the chapter called Basic UNIX reference first and follow some of the links there.

Before going any further, you will have to create the GRASS database:

  1. Find a place on your disk where you have write access and that has enough diskspace to hold your decompressed data.

  2. Create a subdirectory that will hold the general GRASS database (e.g. "mkdir /data/GRASSDATA" or "mkdir /home/yourlogin/GRASSDATA").

Now you can go on. The following subsections will cover different potential "scenarios", each representative of the situations in which a new user might turn to GRASS:

You have a GRASS database

You have a tar ball (*.tgz, *.tar.gz, *.tar) with an already prepared GRASS location. Here are the steps to follow:

  1. Enter the GRASS database directory you created above and untar your data file in there (e.g. "tar xvzf /path/to/where/you/downloaded/yourdatafile.tgz"). This should create a directory containing the sample location (e.g. spearfish60), with several subdirectories, each of these representing a mapset. There should be at least one, called "PERMANENT" (note the names of the others). Don't touch anything in this directory.

  2. Go back to your home directory ("cd") and start GRASS ("grass").

  3. First specify in the Database field the absolute path to the directory you created above (e.g. "/data/GRASSDATA"). You can now choose the location. If you download sampledata, it will be spearfish60. Now, you should see at least PERMANENT in the mapsets list. You can create a new mapset by enter its name in the left field and click on "Create..." button. Select one them on the mapsets list. Click on "Enter GRASS" button.

  4. The GIS Manager should start automatically.

  5. See the chapter called The Most Important Commands to Get Started for the next steps.

You have a georeferenced data file, and know its geographical coordinates

You have a file in a georeferenced format (GeoTiff, shape, etc) and have all the information concerning the projection the data is in, its geographical extensions, and, if it is a raster file, its resolution. You will have to create a location according to that information. Assuming that the file is in your home directory, here's what you have to do (if it somewhere else, just change the path to the file when entering the relevant commands)):

  1. Create a new location according to the information you have and the steps described in the chapter called Set-up your location.

  2. Once you have entered GRASS, you can import the file with the appropriate module as described in Part VI in Grass Tutorial. (You can use the graphical user interface for most imports: start it with d.m&).

  3. When you have finished the importation process, see the chapter called The Most Important Commands to Get Started for the next steps.

You have a georeferenced raster file, but don't know its geographical coordinates

Someone gave you a geocoded raster file (GeoTiff, shape, etc) or you downloaded it from somewhere, but you have no information as to its geographical projections, its extension, or its resolution. You, therefore, do not know how to create a location that is appropriate for this data. Here's what you can do:

  1. Check here if the format your file is in can be imported and georeferenced by GDAL. If it can't, see if you can convert it to any of the supported formats. If that is not possible, you're out of luck and will have to move on to the Section called Other situations.

  2. Start GRASS ("grass").

  3. Click on "Create New Location".

  4. In the terminal screen you see, enter a name for a temporary location (e.g. "LOCATION: temp"), leave the mapset at its default (your login name) and set the database to the directory you created at the very beginning (e.g. "/data/GRASSDATA").

  5. When told that the "LOCATION (temp) - doesn't exist" and asked whether you would like to create location (temp), you answer "yes, please" (well actually you just press 'y'.)

  6. You press 'y' again pretending that you have all the information listed on the next screen as being absolutely necessary.

  7. When asked to specify the coordinate system, chose 'a' for "x,y" and then 'y' (or just ENTER) for "yes".

  8. Enter a description of your location, such as "temporary x,y location for import", press ENTER and confirm your beautiful title with 'y' or ENTER.

  9. Don't even look at the next screen (entitled "Define the default region"), just press ESC-ENTER to get it out of your sight as quickly as possible. Again, confirm your "choice" with 'y' or ENTER, plus another ENTER to congratulate GRASS for having created your new location.

  10. Don't panic because you've been returned to the very first screen. It's normal. Press ESC-ENTER, and life in GRASS can begin !

  11. You are in a shell that is just like any other UNIX shell, only for the GRASS prompt and some environment variables that have been added (but that you don't have to worry about).

  12. Now we will use the magic of r.in.gdal:[1] in the command line type "r.in.gdal in=RasterFile out=GRASSRaster location=NewLocation", where 'RasterFile' is the name (and, if the file is not in the current directory, the path) of the raster file you want to import, 'GRASSRaster' is the name you want that map to have in GRASS, and 'NewLocation' the name of a new location r.in.gdal will create automatically for the new map, and which will contain all the geographical information (projection, extension, resolution) included in the orginial raster file.

    You may also use v.in.ogr instead of r.in.gdalif you have vector data. GRASS need to be build with OGR support to use this command.

  13. If all goes well (i.e. no error messages), you now have to enter the new location just created automatically by r.in.gdal or v.in.ogr. Since you cannot change location within a running GRASS session, you have to leave GRASS ("exit").

  14. Restart GRASS. This time it should come up with the Tcl/Tk welcome window. The window will list the available locations and mapsets in your GRASS-Database. Chose the new location just created by r.in.gdal/v.in.ogr ('NewLocation'), and chose the mapset that is called after your login name. Then click "Use Selection".

  15. Congratulations, you made it (I hope !). Now you can move on to the chapter called The Most Important Commands to Get Started to actually do something with your map.

You have a non-georeferenced data file

You scanned a map and now have a non-georeferenced raster file, Or you downloaded a nice PNG file of a political world map from the internet. Or you drew a map of your garden in the GIMP and now want to use it to manage your plantings. In other words, either you do not have the georeferencing information of this map (and it is not included in the file format) or you do not care about projection for your use of the map. This section is for you.

Before going any further though, a word of advice: if you only plan on viewing the map, and not doing any real work concerning geographical *information* (i.e. linking data with geographical coordinates), then maybe GRASS is not the right tool for you. GRASS is a full-fledged GIS, and not a map viewer, and using it just to quickly view some maps would probably be overkill.

Since your map is not georeferenced, you can import it into a simple x,y location, i.e. where the coordinates directly designate pixels on the screen. In order to do so, just follow the steps described in the previous section, up to the r.in.gdal call. However, in this case you will not use the the 'location=' option, but just type: "r.in.gdal in=RasterFile out=GRASSRaster" (you can also use one of the other raster import commands). That's it ! In order to learn how to view your map and do other basic operations, see the chapter called The Most Important Commands to Get Started.

If you have a scanned map and you have access to the geographical information concerning the original paper map, then you should read the chapter called Processing Scanned Maps.

Other situations

So, you have a file, without much information about it, but you think (or know) it should be georeferenced. For example, someone sent you an ESRI shape file containing a map you would like to work on. Or you received a raster in a binary format that is not supported by the GDAL library. Here are some tips on what you might want to do, depending on the usage you will make of the file:

Notes

[1]

If you compiled GRASS yourself, be sure to also have installed the GDAL libraries, otherwise r.in.gdal will not work. This is also true for v.in.ogr that require OGR libraries.