NCSU GIS/MEA582:
Geospatial Modeling and Analysis

Data display and visualization

Resources:

Start GRASS GIS

Your current mapset should be a previously created assignment2 in the nc_spm_08_grass7 project, you can continue working in it or create a new mapset (e.g., assignment2b) following the instructions from the previous assignments.

To save your outputs and to store external data change your working directory to the one that you created in previous assignment e.g., C:\Users\myname\Documents\GIS582_HW\report2, type cd into Console and hit Enter:

cd
then browse to and select your report2 directory.

Changing the default font

Change the default font used for map rendering in GUI Settings: File > Preferences > Map Display. Pick a new default font and Save the settings.
Note, that you can also change the default color table, default vector display properties and other display behavior in GUI settings.

Basic 2D display operations

GUI is recommended for the tasks below, see the GUI equivalents for selected d* commands, the command line instructions below are to indicate the workflow and output.

Display subset of raster data

Visualy explore relation between developed areas and topography. Remove all previously used layers from the Layer Manager, then set region and display land use categories 1, 2 (developed land) over shaded topography.
Settings > Region > Set region > Set region to match this raster > select "landuse96_28m".
Add raster > select "elevation_shade".
Add raster > select "landuse96_28m" > Selection > List of cats to display > 1,2.
Zoom to computational region.
Right click on "landuse96_28m" map layer and Change opacity to show topography blended with landuse. Save display to graphic file.
d.erase
g.region raster=landuse96_28m -p
d.rast elevation_shade
d.rast landuse96_28m values=1,2
#make sure to change opacity of the landuse layer to combine it with shaded topography
d.vect streets_wake
d.out.file landuse_elev

Display color composite and subset of raster data

Visualy explore the development in the 1996 land use map layer and the 2002 landsat imagery using similar approach as with the shaded elevation above, but here we use a landsat 2002 image composite
In Layer Manager: Add various raster map layers > Add RGBmap layer.
d.rgb red=lsat7_2002_30 green=lsat7_2002_20 blue=lsat7_2002_10
d.rast landuse96_28m values=1,2
#make sure to change opacity of the landuse layer to see the developed areas in 2002 and 1996
d.vect roadsmajor color=yellow
d.out.file mylandsat
How did the developed area change between 1996 and 2002?

Change colors for raster maps

There are many ways how to adjust or create custom color ramps for raster maps, see r.colors manual, we explore only some basic tools here.

First create your own copy of the elevation map (see the command below).
Display it by Add raster > "myelev".

g.copy raster=elevation,myelev
d.rast myelev

Set the color table to a predefined one (feel free to select a different one than the suggestion below, e.g. sepia).

GUI options: Right Click on the raster layer "myelev" in Layer Manager > Set color table > Define > Name of color table > "elevation" > Run.
If you don't see the new colors - click the first button in Map Display to redraw.

r.colors myelev color=elevation
d.rast myelev
d.out.file mynewelevation

To create color table for future multiple uses, especially for scripting, type the rules into a plain text mycolor.txt file using a text editor (TextEdit, Notepad) and save it in your working directory, for example (feel free to use your own colors):

50 blue
70 aqua
90 green
110 yellow
130 orange
160 brown

Then assign it as follows:
Right click on "myelev" map layer > set color table > Define > Path to rules file > Run.
If needed, redraw using the first button on Map Display. You can also create and assign the above color table by typing or pasting it into the enter values interactively window or run it from comand line (make sure the rule file is in your working directory):

r.colors myelev rules=mycolor.txt
d.out.file mynewelevation2

Note that you can combine color RGB and name definitions as well as % and cat/val to create complex custom color tables and store them in a text file for future use, see the examples in r.colors man page.

Compare the use of equal interval and histogram equalized color table for slope

First, we set an equal interval color ramp to our copy of the slope map. To add the legend use Add map elements button on Map Display.
g.copy raster=slope,myslope
r.colors myslope color=bgyr
d.rast myslope
d.legend myslope
d.out.file myslopecolor

Now set the histogram equalized color table, and save the new slope map.

r.colors -e myslope color=bgyr
d.out.file myslopecolorequalized

To explain the difference between the two maps, you can generate a histogram. On Map Display click on Analyze map > Create histogram with d.histogram to open the histogram tool and save results to graphics file. Or use this command which will add a histogram as a layer to Layer Manager and then save the image:

d.histogram myslope
d.out.file slopehistogram
What is the effect of the histogram equalized color table on the slope map pattern?

Modify legend, scale and grid

To re-size the legend for myslope, right click on the legend, select Resize legend and resize with mouse. Alternatively you can resize by selecting Pointer mode in Map Display, double clicking on legend to launch the legend dialog and set options > Optional > Placement > 50,90,4,7.
Numbers are bottom,top,left,right as percentage of screen coordinates.
Add units to the legend: Add map elements > Add text layer > type deg > OK.
Add barscale on Map Display: Add map elements > Add scale bar (double click on it to change iti, for example you can change its length and units under Optional tab).

Note: you can use horizontal legends by using Placement at=6,10,2,30 or just stretch it horizontally with mouse.

d.barscale length=1000
d.legend myslope at=50,90,4,7

Switch off "myslope", display "myelev" raster and change the legend to "myelev" raster. Add grid for state plane coordinates at 5000m with ticks at 1000m. Also add a lat/long grid at 2 arc minute interval.

In Layer Manager > Add various overlays > Add grid layer > Size 5000 > Run.
To draw only border with ticks: change Size to 1000 and click Disable > Disable grid drawing > Run.
Switch off Disable grid drawing.
To draw lat/long grid: set Required > Size to 0:02 > click Draw > Draw geographic grid > Run.
Command line alternative:

d.rast myelev
d.legend myelev
d.grid size=5000 color=brown
d.grid -n size=1000
d.out.file myelevmap_gridxy
#switch off previous grids
d.grid -g size=0:02 color=black
d.out.file myelevmap_gridlatlong

Visualization in 3D perspective

Interactively view "elevation" raster and vector data ("streams", "usgsgages") in 3D view, adjust viewing position, surface properties and lighting to highlight features and display landuse data over topography. Note, that legend is not currently supported in 3D view. Remove or switch off any map layers in the Layer Manager (if you have any) and set region to the raster "elevation".

d.erase
g.region raster=elevation -p 

Then add raster "elevation", and vector "streams", and "usgsgages".
Zoom to computational region and Switch to 3D view.

Follow the video Visualization in GRASS I: surface and Visualization in GRASS II: draping points and lines(legend does not work in GRASS8.4) and save 2-3 images for your report (save as tiff or take screenshot, if you don't have tiff support).

Optional

Visualizing multiple surfaces

Visualize multiple surfaces (bare earth and surface with vegetation and structures),
analyze their relationship using crossections generated by interactive cutting planes

It is recommended to quit GRASS before starting the task below because we will be working with a smaller, high resolution region.

Start grass with your previous mapset. First set region to "rural_1m", then interpolate surface with vegetation from multiple return lidar points using the module v.surf.rst (we will explain interpolation later on).

g.region rural_1m -p
v.surf.rst input=elev_lidrural_mrpts elevation=elev_lidruralmr_1m npmin=120 segmax=25 tension=40 smooth=1.0

In Layer Manager Add rasters "elev_lidruralmr_1m" and "elev_lid792_1m" (bare earth). In Map Display Zoom to computational region.

Make sure that you have only the two elevation maps switched on in the Layer Manager. Switch to 3D view and follow the video Visualization in GRASS III: cutting planes. Save 2-3 interesting images for your report, include at least one crossection. If you do not see the elevation surfaces click Look: "center" in the View pannel of the 3D view.

Optional

Map Swipe

Use mapswipe to compare the new orthophoto with the ortho provided in the data set:
g.mapsets mapset=assignment1 operation=add
File > Map Swipe.
Add raster > select "ortho_2001_t792_1m" and "ortho_new".

Move slider to compare images - what changes do you observe? Save a screenshot of the mapswipe window showing the comparison of orthos. See more options here.