Skip to content

Conversation

@cmbarton
Copy link
Contributor

@cmbarton cmbarton commented Dec 4, 2025

Initial commit of Quarto file and images

Initial commit of Quarto file and images
Copy link
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First round of small fixes, not done yet...

copyright:
holder: Michael Barton
year: 2025
funding: "Creation of this tutorial was supported in part by US National Science Foundation grant FAIN 2303651."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one doesn't show up in the text, so we need to put it there explicitely, I will make a suggestion at the bottom of the page.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm. That's the way we did it with the other ones. If we need to show it another way, we might want to the other ones the same.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but let's do it in a separate PR.


# Summary

Besides the approaches presented here, there are other ways of creating thematic maps in GRASS. Graduate points and lines, with point size and line width proportional to a numeric variable, can be created in the vector properties tool (d.vect). Color tables can be assigned to a numeric vector column in the same way as color tables can be assigned to raster maps. In both cases, it will be necessary to create custom legends following procedures described above. The important point is that GRASS can be used to create sophisticated, high-quality thematic maps from both raster and vector geospatial data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Besides the approaches presented here, there are other ways of creating thematic maps in GRASS. Graduate points and lines, with point size and line width proportional to a numeric variable, can be created in the vector properties tool (d.vect). Color tables can be assigned to a numeric vector column in the same way as color tables can be assigned to raster maps. In both cases, it will be necessary to create custom legends following procedures described above. The important point is that GRASS can be used to create sophisticated, high-quality thematic maps from both raster and vector geospatial data.
Besides the approaches presented here, there are other ways of creating thematic maps in GRASS. Graduate points and lines, with point size and line width proportional to a numeric variable, can be created in the vector properties tool (d.vect). Color tables can be assigned to a numeric vector column in the same way as color tables can be assigned to raster maps. In both cases, it will be necessary to create custom legends following procedures described above. The important point is that GRASS can be used to create sophisticated, high-quality thematic maps from both raster and vector geospatial data.
***
:::{.smaller}
The development of this tutorial was in part funded by the US
[National Science Foundation (NSF)](https://www.nsf.gov/),
award [2303651](https://www.nsf.gov/awardsearch/showAward?AWD_ID=2303651).
:::


Thematic maps are the most common form of analytical visualization done in GIS software. A thematic map uses color, or object shape or size, to represent geographic variation in some property, represented by categorical or numerical values in spatial data.

Most GIS software supports the creation of thematic maps from vector objects (points, lines, and areas). GRASS likewise enables the creation of thematic maps from vector data. It also supports the creation of thematic maps from rasters, which represent space a a grid of cells or pixels.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo at the end of the sentence.

:::

::: {.callout-note title="Don't know how to get started?"}
If you are not sure how to get started with GRASS using its graphical user interface or using Python, checkout the tutorials [Get started with GRASS GIS GUI](../get_started/fast_track.qmd) and [Get started with GRASS & Python in Jupyter Notebooks](../get_started/fast_track_grass_and_python.qmd).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you are not sure how to get started with GRASS using its graphical user interface or using Python, checkout the tutorials [Get started with GRASS GIS GUI](../get_started/fast_track.qmd) and [Get started with GRASS & Python in Jupyter Notebooks](../get_started/fast_track_grass_and_python.qmd).
If you are not sure how to get started with GRASS using its graphical user interface or using Python, checkout the tutorials [Get started with GRASS GUI](../get_started/fast_track.qmd) and [Get started with GRASS & Python in Jupyter Notebooks](../get_started/fast_track_grass_and_python.qmd).

This will produce a map of continuously varying slope across the entire map. Colors can be assigned to raster cells according to their slope values to visualize areas of high and low slope. The slope that each color represents can be shown in a legend to help users interpret the map.

::: {.callout-note title="Modeling terrain in GRASS"}
To learn more about modeling and visualizing slope and other terrain characteristics in GRASS, see the[Visualizing and Modeling Terrain from DEMs in GRASS](https://grass-tutorials.osgeo.org/content/tutorials/terrain_and_DEMs/GRASS_terrain.html) tutorial. For more information about rasters in GRASS, see [Raster data processing in GRASS GIS](https://grass.osgeo.org/grass-stable/manuals/rasterintro.html#raster-map-operations).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To learn more about modeling and visualizing slope and other terrain characteristics in GRASS, see the[Visualizing and Modeling Terrain from DEMs in GRASS](https://grass-tutorials.osgeo.org/content/tutorials/terrain_and_DEMs/GRASS_terrain.html) tutorial. For more information about rasters in GRASS, see [Raster data processing in GRASS GIS](https://grass.osgeo.org/grass-stable/manuals/rasterintro.html#raster-map-operations).
To learn more about modeling and visualizing slope and other terrain characteristics in GRASS, see the [Visualizing and Modeling Terrain from DEMs in GRASS](../terrain_and_DEMs/GRASS_terrain.html) tutorial. For more information about rasters in GRASS, see [Raster data processing in GRASS](https://grass.osgeo.org/grass-stable/manuals/rasterintro.html#raster-map-operations).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized that if we put it this way instead of giving the full html link, the links won't work if the tutorial html is downloaded. On the other hand, if the full link is there and things get moved, they won't work either.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downloading the html tutorial is an unlikely use case, in general the links should be relative.

segment=5,
bgcolor="none",
width_scale=2,
flags="n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
flags="n"
flags="n")


```{python}
gs.run_command("r.univar",
map="slope")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
map="slope")
map="slope")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing the percentiles

Comment on lines +563 to +569
gs.run_command("d.legend",
raster="landuse",
title="Land Use",
title_fontsize=14,
fontsize=12,
border_color="0:0:0:255",
flags="cb")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gs.run_command("d.legend",
raster="landuse",
title="Land Use",
title_fontsize=14,
fontsize=12,
border_color="0:0:0:255",
flags="cb")
gs.run_command("d.legend",
raster="landuse",
title="Land Use",
title_fontsize=14,
fontsize=12,
border_color="0:0:0:255",
flags="cb")

@cmbarton
Copy link
Contributor Author

cmbarton commented Dec 5, 2025 via email

To learn more about modeling and visualizing slope and other terrain characteristics in GRASS, see the[Visualizing and Modeling Terrain from DEMs in GRASS](https://grass-tutorials.osgeo.org/content/tutorials/terrain_and_DEMs/GRASS_terrain.html) tutorial. For more information about rasters in GRASS, see [Raster data processing in GRASS GIS](https://grass.osgeo.org/grass-stable/manuals/rasterintro.html#raster-map-operations).
:::

Create a slope map from the *elevation* DEM map
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Create a slope map from the *elevation* DEM map
Create a slope map from the *elevation* DEM map:

Also there should be g.region raster=elevation before this.

#### Command line

```{bash}
r.colors -e map=slope color=reds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
r.colors -e map=slope color=reds
r.colors map=slope color=reds


- The [r.univar](https://grass.osgeo.org/grass-stable/manuals/r.univar.html) tool can be used to find the cutoff values for the 1st, 2nd, 3rd, and 4th quartiles.

- We could define the 1st quartile (25% of raster cells with the lowest slopes) as 'low slope', the 4th quartile (25% of cells with the highest slopes) as 'high slope', and the remaining cells as 'intermediate slope' (3rd and 4th quartiles, representing the 50% of cells with intermediate slopes).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- We could define the 1st quartile (25% of raster cells with the lowest slopes) as 'low slope', the 4th quartile (25% of cells with the highest slopes) as 'high slope', and the remaining cells as 'intermediate slope' (3rd and 4th quartiles, representing the 50% of cells with intermediate slopes).
- We could define the 1st quartile (25% of raster cells with the lowest slopes) as 'low slope', the 4th quartile (25% of cells with the highest slopes) as 'high slope', and the remaining cells as 'intermediate slope' (2nd and 3rd quartiles, representing the 50% of cells with intermediate slopes).


1. Open *r.univar* from the Raster/Reports and Statistics menu.

2. Enter *slope* as the "Name of the raster map(s)" under the Required tab.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a step here to input the quartiles, no?

Comment on lines +360 to +364
| slope | quartile | slope category |
|:---------:|:------------:|:------------:|
| 0-1.85 | 1st quartile | low slope |
| 1.86-5.02 | 2nd & 3rd quartiles | intermediate slope |
| 5.03-38.7 | 4th quartile | high slope |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| slope | quartile | slope category |
|:---------:|:------------:|:------------:|
| 0-1.85 | 1st quartile | low slope |
| 1.86-5.02 | 2nd & 3rd quartiles | intermediate slope |
| 5.03-38.7 | 4th quartile | high slope |
| slope | quartile | slope category |
|:---------:|:------------:|:------------:|
| 0-1.85464 | 1st quartile | low slope |
| 1.85464-5.02421 | 2nd & 3rd quartiles | intermediate slope |
| 5.02421-38.7 | 4th quartile | high slope |

Comment on lines +390 to +392
0 thru 1.85 = 1 low slope
1.86 thru 5.02 = 2 intermediate slope
5.03 thru 38.7 = 3 high slope
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
0 thru 1.85 = 1 low slope
1.86 thru 5.02 = 2 intermediate slope
5.03 thru 38.7 = 3 high slope
0 thru 1.85464 = 1 low slope
1.85464 thru 5.02421 = 2 intermediate slope
5.02421 thru 38.7 = 3 high slope

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And below the same, otherwise values between e.g. 1.85 and 1.86 won't be reclassified.


### Reclassification

Now we can use the results of the above statistical analysis to reclassify slope into four categories, each of which represents 1/4 of the total raster cells in the map.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be 3 categories.


This map is helpful for showing areas with different slope categories. But it might be more interpretable with a different set of colors. We could pick a different pre-defined color table using the *r.colors* tool demonstrated previously. We can also define a custom color table using the same tool.

Creating a custom color table is as easy as specifying a category number followed by a color.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The color also can be specified as hex number.


This thematic map might be more informative if the many land use and land cover categories could be condensed into fewer. As with the slope map, this can be done through reclassification to assign new values and labels to the existing landuse categories.

We an make a new reclass map with aggregated categories, named *landcover*. Using [*r.reclass*](https://grass.osgeo.org/grass-stable/manuals/r.reclass.html) as described previously, we can reduce the 21 original categories to 7 by combining all the developed land into a single category, all the herbaceous vegetation, all the shrub vegetation, and all the tree cover.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo

#### Command line

```{bash}
r.colors -e map=slope_quartiles rules=- << EOF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
r.colors -e map=slope_quartiles rules=- << EOF
r.colors map=slope_quartiles rules=- << EOF

#### Command line

```{bash}
d.legend -c -b raster=landuse title="Land Use" title_fontsize=14 fontsize=12 border_color=0:0:0:255
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The input raster needs to be updated here.

## Command line

```{bash}
r.reclass input=landuse output=friction_landcover rules=- << EOF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the parameters here

#### Command line

```{bash}
r.colors -e map=slope_quartiles rules=- << EOF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameters here also need an update.

code-copy: true
code-fold: false
page-layout: article
categories: [beginner, intermediate, raster, vector, thematic maps, charts, legend]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
categories: [beginner, intermediate, raster, vector, thematic maps, charts, legend]
categories: [beginner, intermediate, raster, vector, thematic maps, GUI, legend]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants