university of california, los angeles department of statistics statistics...

8
University of California, Los Angeles Department of Statistics Statistics C173/C273 Instructor: Nicolas Christou More on raster maps We will work with data from North Carolina. These data can be found under the LOCA- TION nc spm 07. We enter GRASS through this LOCATION and the mapset PERMA- NENT. There are many raster and vector maps that will be used for some of our tutorials. Let’s open a monitor and display the raster map elevation, which is represents the elevation of the southwest part of the Wake county of North Carolina: GRASS 6.3.cvs (nc_spm_07):~ > d.mon x0 using default visual which is TrueColor ncolors: 16777216 Graphics driver [x0] started GRASS 6.3.cvs (nc_spm_07):~ > d.rast elevation 100% GRASS 6.3.cvs (nc_spm_07):~ > 1

Upload: others

Post on 08-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: University of California, Los Angeles Department of Statistics Statistics …nchristo/statistics_c173_c273/stat_c... · 2010-03-03 · University of California, Los Angeles Department

University of California, Los AngelesDepartment of Statistics

Statistics C173/C273 Instructor: Nicolas Christou

More on raster maps

We will work with data from North Carolina. These data can be found under the LOCA-TION nc spm 07. We enter GRASS through this LOCATION and the mapset PERMA-NENT. There are many raster and vector maps that will be used for some of our tutorials.

Let’s open a monitor and display the raster map elevation, which is represents the elevationof the southwest part of the Wake county of North Carolina:

GRASS 6.3.cvs (nc_spm_07):~ > d.mon x0

using default visual which is TrueColor

ncolors: 16777216

Graphics driver [x0] started

GRASS 6.3.cvs (nc_spm_07):~ > d.rast elevation

100%

GRASS 6.3.cvs (nc_spm_07):~ >

1

Page 2: University of California, Los Angeles Department of Statistics Statistics …nchristo/statistics_c173_c273/stat_c... · 2010-03-03 · University of California, Los Angeles Department

Here is the elevation map:

We can erase a map from the monitor window:

GRASS 6.3.cvs (nc_spm_07):~ > d.erase

GRASS 6.3.cvs (nc_spm_07):~ >

The scale of the map can be displayed as follows:

GRASS 6.3.cvs (nc_spm_07):~ > d.barscale at=5,90

And this is what you get:

2

Page 3: University of California, Los Angeles Department of Statistics Statistics …nchristo/statistics_c173_c273/stat_c... · 2010-03-03 · University of California, Los Angeles Department

To place a legend use:

GRASS 6.3.cvs (nc_spm_07):~ > d.legend map=elevation at=70,15,5,10

And you get:

If a raster map has already a legend you type:

GRASS 6.3.cvs (nc_spm_07):~ > d.rast.leg map=elevation

To get:

To erase a map with legend (the previous map) you need to use the flag -f. If the flag is notused, only the map will be erased.

GRASS 6.3.cvs (nc_spm_07):~ > d.erase -f

3

Page 4: University of California, Los Angeles Department of Statistics Statistics …nchristo/statistics_c173_c273/stat_c... · 2010-03-03 · University of California, Los Angeles Department

To add text to your map use the module d.text. This will open the dialog box window whereyou can add the text, its location on the map, choose the font size, etc. Here is the dialogbox window: And here is the map with the text:

4

Page 5: University of California, Los Angeles Department of Statistics Statistics …nchristo/statistics_c173_c273/stat_c... · 2010-03-03 · University of California, Los Angeles Department

Zooming and generating subsets from raster maps

Once a raster map is displayed on the monitor, we can zoom using the d.zoom module.Therefore we select a subset of the raster map and save the new region. This is how itworks:

GRASS 6.3.cvs (nc_spm_07):~ > d.zoom

1 raster, 0 vector

Buttons:

Left: 1. corner

Middle: Unzoom

Right: Quit

With the left button of your mouse click on the raster map to define the first corner of thezoomed region. Then, move the mouse around to define the desired region (a box) and finallyright click to select the region. Note that once you right click you go back to the commandwindow. If you want to keep this new region save it. All these are shown below:

GRASS 6.3.cvs (nc_spm_07):~ > d.zoom

1 raster, 0 vector

Buttons:

Left: 1. corner

Middle: Unzoom

Right: Quit

226170(N) 636670(E)

Buttons:

Left: 1. corner (reset)

Middle: 2. corner

Right: Quit

219280(N) 643080(E)

north: 226170 south: 219270 east: 643080 west: 636670

100%

Buttons:

Left: 1. corner

Middle: Unzoom

Right: Quit

221460(N) 642730(E)

Zooming complete.

GRASS 6.3.cvs (nc_spm_07):~ >

5

Page 6: University of California, Los Angeles Department of Statistics Statistics …nchristo/statistics_c173_c273/stat_c... · 2010-03-03 · University of California, Los Angeles Department

And the zoomed region of the map here:

What do the following commands do?

GRASS 6.3.cvs (nc_spm_07):~ > g.region -pprojection: 99 (Lambert Conformal Conic)zone: 0datum: nad83ellipsoid: a=6378137 es=0.006694380022900787north: 226170south: 219270west: 636670east: 643080nsres: 10ewres: 10rows: 690cols: 641cells: 442290GRASS 6.3.cvs (nc_spm_07):~ > g.region save=myzoomregionGRASS 6.3.cvs (nc_spm_07):~ > d.eraseGRASS 6.3.cvs (nc_spm_07):~ > g.region rast=elevationGRASS 6.3.cvs (nc_spm_07):~ > g.region -pprojection: 99 (Lambert Conformal Conic)zone: 0datum: nad83ellipsoid: a=6378137 es=0.006694380022900787north: 228500south: 215000west: 630000east: 645000nsres: 10ewres: 10rows: 1350cols: 1500cells: 2025000

6

Page 7: University of California, Los Angeles Department of Statistics Statistics …nchristo/statistics_c173_c273/stat_c... · 2010-03-03 · University of California, Los Angeles Department

GRASS 6.3.cvs (nc_spm_07):~ > d.rast elevation100%GRASS 6.3.cvs (nc_spm_07):~ > d.eraseGRASS 6.3.cvs (nc_spm_07):~ > g.region myzoomregion -pprojection: 99 (Lambert Conformal Conic)zone: 0datum: nad83ellipsoid: a=6378137 es=0.006694380022900787north: 226170south: 219270west: 636670east: 643080nsres: 10ewres: 10rows: 690cols: 641cells: 442290GRASS 6.3.cvs (nc_spm_07):~ > d.rast elevation100%GRASS 6.3.cvs (nc_spm_07):~ >

The above commands display the map using the original region for the elevation map, erasethe displayed map, defines the new zoomed region, and displays the zoomed map. Of course,we can generate the above zoomed region using the g.region module that we discussed in aprevious handout as follows:

GRASS 6.3.cvs (nc_spm_07):~ > g.region n=226170 s=219270 w=636670 e=643080 -p

projection: 99 (Lambert Conformal Conic)

zone: 0

datum: nad83

ellipsoid: a=6378137 es=0.006694380022900787

north: 226170

south: 219270

west: 636670

east: 643080

nsres: 10

ewres: 10

rows: 690

cols: 641

cells: 442290

GRASS 6.3.cvs (nc_spm_07):~ > d.rast elevation

100%

GRASS 6.3.cvs (nc_spm_07):~ >

The last command will display the new region of the map.

7

Page 8: University of California, Los Angeles Department of Statistics Statistics …nchristo/statistics_c173_c273/stat_c... · 2010-03-03 · University of California, Los Angeles Department

Generating a new raster map from an existing raster map:Suppose you want to save the zoomed region as a raster map. To do this we use the d.mapcalcmodule as follows. First let’s make sure that our current region is the zoomed region.

GRASS 6.3.cvs (nc_spm_07):~ > g.region myzoomregion -p

GRASS 6.3.cvs (nc_spm_07):~ > r.mapcalc zoomed_elevation=elevation

We named the zoomed region zoomed elevation which is our new raster map and can bedisplayed as follows:

GRASS 6.3.cvs (nc_spm_07):~ > d.erase

GRASS 6.3.cvs (nc_spm_07):~ > d.rast zoomed_elevation

100%

GRASS 6.3.cvs (nc_spm_07):~ >

Here is the zoomed map exactly the same as the zoomed region on page 6.

8