Professional Documents
Culture Documents
GRASS Newsletter Vol. 3 (June 2005)
GRASS Newsletter Vol. 3 (June 2005)
Editorial
proaches on the GRASS user inferface.
These articles outline pretty well some capabili-
by Martin Wegmann ties of GRASS but far more functions could be pre-
sented, personally I would like to see the actual use
Dear GRASS user, of GRASS functions in different projects and a more
detailed presentation of GRASS visualisation poten-
tials.
welcome to the third volume of GRASSNews
which features a broad spectrum of articles.
Looking forward to N o 4, with kind regards
Preprocessing of SRTM data and its further use in
GRASS is the topic of the first two articles. Followed
Martin Wegmann
by GRASS- R articles describing the new GRASS 6 -
R interface and the use of R for raster manipulation.
Moreover r.infer is presented, a tool for Martin Wegmann
knowledge management, this shall be the begin- DRL - German Aerospace Centre @
ning of a series featuring different approaches on Remote Sensing and Biodiversity Unit
knowledge management in GRASS. Dept. of Geography, University of Würzburg, Germany
A very promising preview of QGIS 0.7 including BIOTA-Project
the new capabilities to interact with GRASS and the
presentation of the GRASS extension manager (GEM)
!"
in the News section shows the two parallel ap- #%$&'())+*,.-/!01$)234!'
564)/!7!#4%$31-43&859$
ISSN 1614-8746 2
GRASS-News Vol. 3, June 2005
A@
D@ manual for details). Then the closed .2<(A&A&,6D 1F(&A& ,6D 01<.2!-8'.(A&
418-8'. ;!2'0(' "#$ C&A&6D "'
holes are patched into the original data. The un- ./-+0)' "#$ G&A&6D
derlying idea is to leave as many values as possi-
ble untouched during the void filling. An example
is shown in Fig. 1 and Fig. 2. You can experiment with the tension parameter
An alternative is E
@!B E
D@ which we use be- to minimize the “stair” artifacts in the resulting
low to resample the SRTM DEM to higher resolution. map. Further details to optimize the interpola-
tion are given in Cebecauer et al. (2002).
Peaks elimination
Besides holes, peaks and outliers also appear in the Coastline extraction
SRTM data. They are often artifacts of the interfer-
ometry processing. If you intend to use the SRTM The coastlines are not well indicated in SRTM data
data just for visualization or rendering, the use of because of the limited Radar backscatter over wa-
some simple filters may be sufficient. But to make ter. To some extent this also applies to lakes and
a hydrologically sound elevation model, more com- snow/ice.
plex steps must be performed. There are at least two free vector map prod-
While outlier detection and removal techniques ucts which can be used to solve this problem: the
are virtually unlimited, we propose here just some Global, Self-consistent, Hierarchical, High-resolution
simple examples. It is probably convenient to repro- Shoreline database (GSHHS; GSHHS vector data set
ject the data set(s) to a metric projection first (=
, (2004)) and the VMAP0 vector data (see next section).
within the target location; using
/><?
D>? along Currently original GSHHS data cannot be im-
with
can be helpful to “find” the area of in- ported into GRASS 6 (only into GRASS 5 with
terest):
A>8?
D@8*@ ) but by using
?
it can be con-
verted from an existing GRASS 5 location. There
using r.neighbors: We can zoom to a SRTM tile and is also a SHAPE file version of GSHHS available
then locally calculate mean and standard de- (GSHHS SHAPE format data set, 2004), which can
viation for a given moving window. Then we be imported by using
/><?
but it was generated
verify if a pixel deviates too much from twice from an older GSHHS version. With
@ a
the 3x3 standard deviation and, if so, replace it raster MASK can be generated at an appropriate res-
with the 3x3 mean value: olution and applied with E
B*H
to sharpen the
SRTM coastlines. The GSHHS data as well as the
;981*3 5 ( 6 2;!989 1;!2
VMAP0 data also contain larger lakes.
ISSN 1614-8746 3
GRASS-News Vol. 3, June 2005
Figure 1: Original SRTM data (Trento/Italy re- Figure 2: SRTM data filled with =
>? @
gion) (Trento/Italy region)
The VMAP0 vector maps to read the VMAP0 format. If you are not lucky to
find a precompiled OGDI driver for your computer
The Vector Map (VMAP) Level 0 data set developed platform, you will have to compile the driver your-
by the NGA (National Geospatial Agency, formerly self. To compile the OGDI driver carefully read the
NIMA) was developed in the 1990s on top of the Dig- README file included with the source code.
ital Chart of the World (DCW). It it currently avail- Some special operations are required to make
able in the fifth revision (VMAP-R5) from 2000. The the original VMAP0 file structure accessible to
VMAP0 vector data are produced at a map scale of OGDI/OGR. The commands are indicated in Fig. 3.
1:1,000,000. The data set consists of vector geometry, The syntax to access a VMAP0 layer is somewhat
vector attributes, and further textual data. VMAP0
unusual (in general: A@
!B @
), so their
can be acquired from NGA either on four CDROMs names must be entered carefully.
or online as four big files (VPF/VMAP0 data set, Only then OGR ( *>8? ,
,
/>8?
,
2000). It is divided into 10 themes consisting of 50-70 UMN Mapserver, QGIS) will be able to read these
maps: boundaries, data quality, elevation, hydrogra- data. Note that
has to be added to the path
phy, industry, physiography, population, transporta- when accessing VMAP0 data via OGR. The conver-
tion, utilities, and vegetation. The world coverage is sion of VMAP0 layers with OGR tools is shown in
divided into four libraries based on geographic area: Fig. 4. With
it is also possible to join full
country names or other attributes to the existing at-
North America (NOAMER) tribute tables as well as extracting only vectors of in-
Europe and North Asia (EURNASIA) terest.
The resulting SHAPE files can be imported into
South America, Africa and Antarctic (SOA- a GRASS 6 Latitude-Longitude/WGS84 location. To
MAFR) avoid filtering away tiny polygons, we redefine the
B ><?
parameter to a smaller value:
South Asia and Australia (SASAUS)
"## (28;28;+*2
The map datum is North_American_Datum_1983 /,- . ,<8#!9+!.1;' "## +F28&2(! -
on a GRS80 ellipsoid (EPSG code 4269). In most cases +*0(<!9+!.1; ' " ## +F28&)- . !;<!1;8(!5 D81"
a reprojection will be needed. VMAP0 country codes 18-8 ./1$'0('!9+!.1; ' " # # +F28& "'
1 '.
in the attribute tables can be expanded from DCW
14/1$'0 "!$%!9+8.1; ' " # # +F!2 8&
Data Dictionary (1993), p. 131, and WorldFactBook
(2005).
Direct import of VMAP0 maps into
Data preparation and import
GRASS
The data access is provided through the OGR library
(E
), which supports vari- Instead of converting the maps to SHAPE or another
ous vector formats. It must be compiled with the format beforehand, you can also directly import orig-
OGDI driver (E D>
A@
,?
) to enable OGR inal (but preprocessed for file names) VMAP0 data
ISSN 1614-8746 4
GRASS-News Vol. 3, June 2005
113-/.1 ;<0( 0 "#$ 3
"$# ( ';'0( <0 /!;'
1$!( 2 (;'.- .)*!!18 $8;2'191-'!1$'0<-<12 0#98+F18 $<;2<1 .;12D8!2
3- .1 "'08 1<1 18!!1< 2<34*!!1<3 2 ;<0!!/!!9!-!2'0&
$8;<0< 0 /! !9-!2'0& 0! 2"834*!8183 2 283 9!+F18 3 2 ;<0!+/!!9-82'06
;2'01< 0!+ /!!9-82'0&< 0! /!89-!2'06 2<11 )2'+/ +A/#+8 ) ; 1<.;1 2!(
*!. 0(1 .1+F 2!$'-/03
!2 ( 1<.;1 2(
! " 3 <0! +/!!9-82'0& <0! /!89-!2'06#1'.;1 ,2!(
Figure 3: Shell code to fix the original VMAP0 file/directory names for OGDI/OGR usage.
113-
"##
.1 "#$ ;'#.;12 ; .1 ;<0( 3
(28;28;+*2
# # (/28;2
!
"$# ( ';<0( <0 /;'
.<01 3 . 0!;!-89- . 82 9!;2!( - .#.1 0 9- .1 3
" #%$ &
%
(2 /!3 ' "$# ' # # !/ ;'9/ ' "## 2
- .3# # . !9- 0-!$8;!9 +*!.1;<-<12
5 !9 !'.:
<8- .3 <" #"2*+;< # 9<083?' " #%$ '
)4!9+!.1; !.15 :!;'1;D)
!
8$ './1<!0 <1'!81$'0 !9-'0-!$8;!99!*!.1;<-<12 45 !9 ! .:
<86!<! "<02'2 ),+- .-'0(!1<2'34&5!687*) -
!9+!.1; ' " ## +F28&2(! 9'08 3?' " #($ '
)4 !9!!.1; +!.165 :!;<1!;D)
<8- .3 "2!*+;< #!9!!.1; ' " # # !F28& 2!!( ! 9+8.1;' "## +F!28&
!
8$ './1<!0 <1'!81$'0 $8!;2'09- .12 5,9- .1A:
<86!<! "<02'2 ),+- .-'0(!1<2'34&5!687*) -
$8!;2'09 ' " # # +F28&2!(8 9<0< 3?' "#%$ '
)$8!;2 09 !.165 :89- .1*)
<8- .3 "2!*+;< $8!;!2'09 ' " # # +F!28&,2!(! 8$ !;2'09' "## +F28&
! %
8$ './1<!0 <1'!81$'0 $!-'0-<12 54!9 !'.:
<86!<! "<02'2 ),+- .-'0(!1<2'34&5!687*) -
*-89<0*!; ' " ## +F!28&,2!(! 9<08 3?' " #%$ '
)=*-89<0*!; <'65 :!;'1;D)
<8- .3 "2!*+;< )*-<9<0*!; ' " # # +F2<&2!(!B*-<9<0*!;' "## +F2<&
9!!! ;'0#0(1 ;'2 F-'0( *)# + ,
5=(0808 3 !FFF 8-!2D,'!:
,!-!2)D2(!
Figure 4: Shell code to convert VMAP0 maps to SHAPE file format with OGR tools.
into GRASS 6. This requires a Latitude-Longitude easily generate using the right EPSG code. To cre-
location with NAD83 geodetic datum which we can ate a NAD83 location in GRASS 6, start GRASS and
ISSN 1614-8746 5
GRASS-News Vol. 3, June 2005
hit the "Create Location from EPSG" button. For the Final remarks
new location name we enter "vmap0nad83", as EPSG
code we enter number "4269". If you never have used The SRTM and VMAP0 data close an important gap
GRASS before, the database field must be filled as in the availability of worldwide spatial data. This is
well, otherwise it will be predefined. Then click "OK" of particular interest for countries where either spa-
to create the location. tial data are lacking or unaccessible due to political
A terminal window will open and ask for "Datum or economical constraints.
Transformation Parameters". To list the available op-
tions, enter "list" (use space bar to scroll down, q to
quit). We select "6" - "Used in Default nad83 region". Acknowledgments
Then you will be notified that GRASS closes itself af-
The author is grateful to Frank Warmerdam for
ter having created the NAD83 location. We start the
his continuous support and availability to resolve
software again and select the new "vmap0nad83" lo-
OGDI/VMAP0 issues.
cation.
After entering, we can verify the projection with
=
, : Bibliography
Cebecauer, T., J. Hofierka, and M. Suri, 2002
! +" F
#
C2 !22
Processing digital terrain models by regularized spline with
%
# " C2C%<!0( # 18-8$8;'. ;<0*+ &!52
tension: tuning interpolation parameters for different input
datasets. In B. Benciolini, M. Ciolli, and P. Zatelli, editors,
# !# (
$ G2 !22 7!5&/5 6 6D 6!686A&& Proc. of the Open Source Free Software GIS – GRASS users confer-
8& =* ence 2002, Trento, Italy, 11-13 September 2002, September 2002.
$ "" C2 81!1<.F-!$!(
2
22
%/2$$$3 5 /!2 54 5 $94$-%$(4$3
3%0$
%/)& 5 2'
% C211<!1!12 &8&D8566DA&8&5!5 EGM96 geoid model, 1996
22
$(32 7"/)%0 56)&( 5 '/
()9
!#&$&'$&'
5 2'
Now we can import the original VMAP0 maps GSHHS vector data set, global shorelines, 9/2004
22
!### 50$!2 5 ( #%(//"5 $94#%$
$
&
&
5 2 '
directly:
GSHHS SHAPE format data set, global shorelines in SHAPE
"## (28;28;!*2 format, 1/2004
2 2
!### 65 )&9 56)0(( 5&%0'&& 03$/)%$
9(2(
# # (/28;!2 &
&
"$# ( ';<0( <0 +/!;'
#%$ & !
%
"
(2 /!3 ' "$ # ' ## /!; 9/ ' "## 2 GLCF SRTM WRS2 tiles server, 2004
22
&! 564!'/(
564!'9 5 $949%(2(!32!'
-!2'0#;!9!9#9!;% 182D3
"
/ - . ,'! "!912 .(2 9<08 3?' #%$ 2 +*0!(1*+ NASA SRTM original tiles server, 2004
2
$
'
"4 5 $
56)%(( 5 &%0!32'
<80 3 !9-'0-8$8;!99+*8.1;<-'12
;<0 2!*!.;<0-<'.;!9 981/19*3
VPF/VMAP0 data set, Vector map Level 0 data set, 2000
22
$(32 7"/)%0 56)&( 5 '/
#%((0!-%$$2(32 5 2'
or
#%$
22
&$0$)&/)%$ 56)/ '( 5 '/
&$%0%%(2/(
$&,'
'
($
/ - . ,'! 12 .(2 9<083?' " 29- )+*-, * ,
. $/! #%$-/)2$33(!230('
5 2'
+*0(' " # # '!9+!.1;B-
'
9!; 18!(*)4!9!!.1; +!.165 : !;<1!;D) DCW Data Dictionary, 1993
22
!### 5/- 56)
4 5 $94!2(!0&/9#90 59
#
+(+F 8$ !9+*+.#.;12D3
World Fact Book: Appendix D - Cross-Reference List of Country
$ ' "## '!9!!.1;
/ - .3 "< Data Codes, 2005
2 2
!### 5%/( 5&%0%/(!%4-/(2/0!)
(2-000
-!2 98; -<!011 ;' 3 (
%$)9/21(
%$)9/21%79 5 2'
418-<'./1$'0!(' "## '!9+8.1; "'
1 ,'.
1 =/1$'0 "$<' " # # '!9!!.1; Markus Neteler
ITC-irst - SSI - MPBA
Via Sommarive, 18
To reproject the map(s) to another projection (e.g., 38050 Povo (Trento)
Latitude-Longitude/WGS84) a separate location is Italy
35464!798;:<:>=?7A@ 46E 4
needed. Within that location run
, to reproject BDC BFC
the VMAP0 map(s) into this location. ?
HG<I >8H >!
ISSN 1614-8746 6
GRASS-News Vol. 3, June 2005
by M. Hamish Bowman
Chateau Tongariro
Introduction
In 1992 the US government’s Defense Mapping
Agency (DMA) released the Digital Chart of the
World (DCW) which contained the most complete
vector representations of the world’s coastlines,
roads, and so on available in the public domain. The
DMA was later folded into the National Imagery and
Mapping Agency (NIMA) which in turn is these days
part of the National Geospatial-Intelligence Agency
(NGA). In 1995 NIMA released an updated version
of the DCW and renamed it Vector Smart Map level
0 (VMap0).
In February 2000 as part of a joint collaboration
between NASA, NIMA, and the German and Italian
space agencies, the Space Shuttle Endeavour carried
out the Shuttle Radar Topography Mission (SRTM) Figure 1: View of the Tongariro National Park SRTM
which mapped the Earth’s surface in unprecedented tile overlain by VMap0 road data. Plotted with
detail. In late 2004 the complete raw data from ps.map.
this mission was released to the general public on
NASA’s website. This dataset provides a quite re-
markable leap in availability of topographic informa- Obtaining the data
tion for many remote parts of the world.
In this article we will see how these two datasets SRTM information is available from the Shuttle
may be easily loaded and plotted in GRASS GIS Radar Topography Mission homepage at NASA’s
6. For example purposes, the area covered will be JPL website:
22
!### 5 56)%(( 5&%0!32!'
around Mount Ruapehu, a semi-active volcano in
New Zealand’s North Island; perhaps familiar to Data coverage for the United States is available at
many as "Mount Doom" in the recent Lord of the 1-arcsec (approx. 30m) resolution and the rest of
Rings movies. Mount Ruapehu is located in the heart the world up to 60 latitude is available at 3-arcsec
of Tongariro National Park1 , notable as the fourth (approx. 90m) resolution. The r.in.srtm module dis-
National Park established worldwide and a tapu (sa- tributed with GRASS 6.0 is designed for the 3-arcsec
cred) place of the Māori people. UNESCO2 has con- data. For loading 1-arcsec data you will need to
ferred rare dual World Heritage status on the Park in obtain the r.in.srtm script from the development ver-
both cultural and environmental listings. sion of GRASS. The raw data is distributed without
All GIS commands are given for GRASS 6.0 and restriction and may be downloaded from the follow-
are also available through the GRASS GUI menu sys- ing NASA FTP site:
tem, although not listed here. More detailed instruc- 2
$
'
"4 5 $
56)%(( 5 &%0!32'
tions on the import and cleaning of these datasets The data files are divided into separate directories
can be found in the preceding article in this issue on the FTP site by continental region and exist as
of GRASSNews. Further information about work- compressed 1 degree square HGT files. Tongariro
ing with maps on a planetary scale can be found National Park is covered by the S40E175 (40 South
in a companion article by the author in GRASSNews latitude, 175 East longitude) tile in the "Islands" re-
volume 13 . gion:
1 22
!### 59%0 5&%0 2 56) 1 /
1
03%$
+" (2/!0)%( 7 (
3 0,0!)&(3/3%07 ) (2/!0!)(7(3
0/)%9$1 5 (%
)
2 22
!# 564)%$
0 5 03&
3 2 2
&3(
5 /2 5 /2 !)%$# $22$3 %* $
$ ) $# %
0 ""5 9
ISSN 1614-8746 7
GRASS-News Vol. 3, June 2005
2
$
'
"4 5 $
56)%(( 5 &%0!32!' *
()9+$/+" 5 &2 51/- ## ##);%418-8'. ;2 0(#<& &D* ;+F
#)# ;%=3-8989'.*9!9!2 - .!*0!(#<& &D*4;+F -
+*08*0(<# & &D
(1.7mb download)
The Mapability.com website provides an easy inter-
face for downloading compressed versions of the 1:1 To save disk space we can now remove the raw
million scale VMap0 data from NIMA. The same site version of the map.
details copyright restrictions on the dataset, which is
ostensibly released into the public domain.
# ##);%41/1#;2 0(#<& &D* ;+F
22
!### 5 '( %(-!/ /2 5 0
' /) %
0 '( /)9$ 1 5 2
'
The SRTM data can now be displayed in the
The VMap0 data is also split up into a number of con- GRASS display monitor with the following com-
tinental regions; Australasia which we are interested mands:
in for this article is contained within the "sasaus" re-
## ##); 1,'.
gion.
!"
"#$ $ %
$&' '(!")*
+ #)# ; #
14;2 0 <& &D
(240mb download)
If you don’t mind getting your hands dirty, you
The VMap0 dataset must be uncompressed after
can make the coastline appear a bit crisper without
download and its directory structure sanitized as de-
modifying the underlying data by,editing the map’s
tailed in the preceding article in this issue of GRASS- -
color table. It can be found in the G/.1032<I di-
News. The SRTM data is accessed by GRASS in its
rectory; with a text editor change the two 0 elevation
compressed form.
rules to 10. (elevation is the left most number of each
grouping, the others are red, green, and blue intensi-
ties)
Importing into GRASS
Both SRTM and VMap0 data are distributed in VMap0
Latitude-Longitude coordinates, although they use Loading VMap0 data into GRASS is achieved with
different map datums. If we blithely assume that the the v.in.ogr module. The OGR6 library must be com-
error from incorrect datum settings is smaller than
piled with support for the OGDI7 driver. Detailed in-
the inherent error due to the resolution of the VMap0 structions on setting up OGR with OGDI support is
data, we can load everything into a Lat-Lon location listed in the preceding article in this issue of GRASS-
using the WGS84 datum (EPSG code #4326). If you News. You can check that the OGDI driver is ac-
wish to use the data for more than just visualiza- tive by running the following command at the shell
tion purposes and perform the import using the cor- prompt and making sure that OGDI is listed.
rect map datums, please see the instructions in the ' <!- .3 "!"3'!;<02
preceding article in this issue of GRASSNews. Users
wishing to create high resolution maps of the United To load the data, we first set up the directory path
States may wish to use NOAA’s Online Coastline Ex- required for the OGDI driver by adding " E
"
tractor4 or the U.S. Census Bureau’s high resolution to the directory structure. For example if the data is
TIGER5 maps instead of the VMap0 data, in addi- located in
, as a shortcut we
tion to using the higher resolution SRTM-1" elevation can setup a shell variable containing this data path
data. in the format that the OGDI driver requires:
# ##); 54 (2 9<08 3 /!3!+/;<!!98$8;!9'0'1;<0;-
/!;' /2<;2 /!;'9/28;28;!*2A2
SRTM
The r.in.srtm module is used to import SRTM data. We can then check for available layers with
As the raw data file may contain some holes and v.in.ogr’s 6 flag. To make the output easier to read,
other artifacts we note this in the output map name. we trade commas for newlines with the UNIX " "
command.
# ##);%- .2'!0! -/.!*0(#<& &D - # ##); /- . <! "!9 % 54 2%!*08*0!(1*+B-
+*0<*0('# & &D*4;+F
12 .(2'
0! ) ) )?-'.)
To correct any holes in our new raster map, we Data layers may also be listed with the ogrinfo
clean the data with the r.fillnulls module after ad- program.
justing the region settings to match the bounds of the
imported map. ' <!- .3 <" B2' 54 2%
4 2
2
!### 56)&9 56)0(( 5&%0 '&& 03%$ /)$ 03%$ /)$ 5 2'
5 22
!### 5 $) 4 5&%0 &$0 !### 2/&%$3 /)9$ 1 5 2!'
6 2 2
!### 5&9( 5 03& 0&3
7 2 2
0&9/"5 0!43 $ %03&$ 56)$2
ISSN 1614-8746 8
GRASS-News Vol. 3, June 2005
# ##); ## (2&/7 "D & "<52
ISSN 1614-8746 9
GRASS-News Vol. 3, June 2005
ISSN 1614-8746 10
GRASS-News Vol. 3, June 2005
ISSN 1614-8746 11
GRASS-News Vol. 3, June 2005
These slots are inherited by all the other classes. Using the spgrass6 package with
0 *>. >8?D@ is a 0 D> object with coordinates,
and 0 *>. >8?D@ 8B is a 0 *>. ><?D@
raster data
object with data in a data frame slot, one row of data
Provided that the spgrass6 package has been in-
per point coordinate; 0 *>. ><?D@ must have at
stalled following the packages it depends upon, sp
least 2 dimensions. Data frames are the main work-
and rgdal, the interface is used more or less as be-
horse of computing in : , they are very much like data
fore. : is started from within a GRASS session from
base tables, where the number of rows (records) must
the command line, and the spgrass6 loaded with its
be the same for each column, but the columns (fields)
dependencies:
can vary by type. @#
# 8)#
)
C'
Raster data are handled in the 0 *>.*> @ (%0(9/)& 3$4/3$9 %( %0%(&$ 3&9(
and 0 *>*> objects, and their associated (%0(9/)& 3$4/3$9 %( %0%(&$ (-/)9
(%0(9/)& 3$4/3$9 %( %0%(&$ 2/ 1'(
!B objects. The difference between the two (%0(9/)& 3$4/3$9 %( %0%(&$ %
is that while a 0 D>D> object has to be a full,
rectangular grid, a 0 *>.D>
@ object can be in- The sample location used here is Spearfish, with
complete. Both have a grid slot with a *>;I @ the default region settings:
object defining the grid itself. 7 # <
=48'
Vector data of more complex types than point co- 3%0 $!2/!0!
) " . , ,
1%0!)%$ "
ordinates are handled as lines or rings, in hierarchies 9(24!5 ' )%(9
of objects. The top-level objects are 0 *>D>8? @ $
-/ 0/9 (3 0
and 0 D>*
><?D@ , and can be bound to object at- )032
"%
0!42 "
tributes in data frames, one data frame row per #%$ !2
member of the 0 *> >8? @ or 0 *>* >8? @ ob- $( !2
jects. The 0 D>D ><? @ and 0 *>
*
>8?D@ objects ) !3$ 6
are built of lists of 0D >8? @ and 0*
><?D@ objects, which $#3$ 6
3%0!#6
themselves are lists of atomic 0D >8? and 0* >8? ob-
0 6
jects. No topology checking is done in sp on these
objects. There are wrapper functions for import- At the present stage of the new interface, raster
ing shapefiles (using the maptools package) and data transfer is done layer by layer, and uses tem-
e00/ArcInfo v.7 binary coverages (using the RAr- porary ASCII files in Arc ASCII grid format. The
cInfo package), and for exporting shapefiles (using following command reads the soil pH values into a
maptools). 0 *> *> 8BH object, treating the values re-
turned as floating point (double in : ):
=
)632
4 # !
%
H @G+C:=
) 6B'
>
# 8=
)6'
'!- $!2 0 (
$%(2/( 3/9%(2(3('$
Using graphics with sp objects 0039/)%(2$6
'/) '(1
003 9 5 1+"
Display functions are provided for sp classes using 003 9 5 1 " "
both base and lattice graphics. The motivation for * 3%0 $!2$9 , . /
this is to make it possible for interface and data im- 3%0 !23/)H & "! 3%0 #42'%$
3%0 !23/)& &"!1%0!)%$+ # "$
port/export packages, and data analysis packages, 3%0 !23/)& &"!(#
5
$
to concentrate on their core functions. This provision 3%0 !23/)& &"!
3
#
5
$
means that, while the legacy interface to GRASS 5 3%0 !23/)& &"!)
0 9$ '$
3%0 !23/)& &"!)%(9&3/ 9 '# 0!)4 '$
needed to provide plotting functionality, the new in- ) 4!'-%$3 0 0/) 2 6
terface can rely on it being provided by sp if GRASS 3/9 (223/-42$ 6
data is held in : in sp classes. The sp display facil- $
$)23$ 5 0
$2 $
%/1$ $
59/ '
ities are under active development, with help from "
" "
the developers of lattice/trellis graphics in : . Lat- %(2( (223/-42$6
tice graphics are analytic graphics more than presen- 0!/ 5
tation graphics, using panelled displays to explore , /) 5 5
the way different variables condition relationships. "!2)(!4
5 5
, $9/(H ) 5
A typical example would be to explore anisotropy , $() 5
in variogram displays by panels showing different 39)(!4
5 5
directions; much of this has been accomplished in , ( 1 5 5
) *+*
5
Edzer Pebesma’s gstat package (Pebesma, 2004).
ISSN 1614-8746 12
GRASS-News Vol. 3, June 2005
8=
)60=
) 6B! != * # != =@# C'
'
'
Development will move towards binary transfer, ) % < C ' <
and to using GDAL. As this example shows, how- ( ' ) % * 9 ?
I*I# != =@# C'
'
ever, GDAL using the GRASS plugin accesses and ( ! * ) * 7B! 6<=@# " *,+-./ '
transfers the data using its region and resolution set-
tings, not the current region: A feature of the legacy interface was the ability
@#
# 8EF)G
H '
CI2
4
C 8'
to move category labels to : ; this is at present emu-
I?
2
4
) A
C E 1F
G)1!/
C @H @G+
G )/ lated by matching the labels reported by GRASS us-
(
/!
- )G
/ + ! !
6 %&! =
) 6B! ing E
A@D@ 6 to the integer values present in the
(
5* 8;' raster data. This is implemented in the $#/2 & % @!
=
)6
EF)G
H2
4 # !
%8EF)G
H 7?
' function, when the argument is set to I ( '12 . As
>
# 8=
)6
EF)G
H '
before, category layers are represented in : as
'!- $!2 0 (
$%(2/(3/9%(2(3('$ columns:
0 039/)%(2$6 %)
2 4 # !
%
H @G+C:!)
!
= $ %) '
'/) '(1 !=
2 4 # !
% @/
H
H C:
%!= # !
1
"%
"
"%
(
*,+-./ '
* 3%0$!2$9 ) *
3%0!23/)&H ) *
$
>
# $!= '
) 4!'-%$3 0 0/)26 '!- $!2 0 (
$%(2/(3/9%(2(3('$
3/9+(223/-42$6 0 039/)%(2$6
$
$)23$ 5 0
$2 $
%/1$ $
5 9/ ' '/) '(1
1
"%
003 9 5 1+"
" "%
003 9 5 1 " "
%(2( (223/-42$6 * 3%0 $!2$9 , . /
-%()9+" 3%0 !23/)H & "! 3%0 #42'%$
, /) 5 5
3%0 !23/)& &"!1%0!)%$+ # "$
"! 2)(!4 5
5
3%0 !23/)& &"!(#
5
$
, $9/() 5
3%0 !23/)& &"!
3
#
5
$
, $() 5
" 3%0 !23/)& &"!)
0 9$ '$
39)(!4 5
5
3%0 !23/)& &"!)%(9&3/ 9 '# 0!)4 '$
, (1 5 5
) 4!'-%$3 0 0/) 2 6
) *+* " 5
3/9 (223/-42$ 6
$
$)23$ 5 0
$2 $
%/1$ $
59/ '
"
" "
%(2( (223/-42$ 6
() 9 0 $3 5
'
/
$3&3$$))03$ !2 "
3(
() 9 )%$3-%( $0!4
( !243$ )%(
$'(
3(/ )
/'$3&$) 2 )%$3-%( $0!4 &%$2 ()9 6
'2 $3 "
) *+* "%"%"
ISSN 1614-8746 13
GRASS-News Vol. 3, June 2005
( F<@# =
'
#* >)
!* &=
<!
Figure 2 shows how much of the functionality
(
,*
'
'
of the legacy raster interface has been maintained,
@#
#
!=
=)
'
by relating elevation and landcover categories in the 0#
2
4 # !
%86
) F<@#0 >)
86!
same way as Neteler and Mitasova (2004) relate soil (
,* 8;'
'
#%)2
4
#
&=
#
'D!= ** '
types and elevation (pp. 339–340): )2
4 -1BA
C #
= )'
>F 2
4"1
!
=
F
#
!=
=@#%) * #%)
( #
= ) #
* ) %
*I#
$%
)'
>
# >F '
'!- $!2 0 (
$%(2/( %0/)2%(2(3('$
0 039/)%(2$6
'/) '(1
003 9 5 1+"
"
003 9 5 1 "
"%
* 3%0 $!2$9 , . /
3%0 !23/)H & "! 3%0 #42'%$
3%0 !23/)& &"!1%0!)%$+ # "$
3%0 !23/)& &"!(#
5
$
3%0 !23/)& &"!
3
#
5
$
3%0 !23/)& &"!)
0 9$ '$
3%0 !23/)& &"!)%(9&3/ 9 '# 0!)4 '$
) 4!'-%$3 0 0/) 2 6
%(2( (223/-42$ 6
(2 !2+
3 "
, /) 5 ""5
+$$
2 $ %/2$
"!2)(!4
5
5
, $9/(H ) 5
, $() 5
39)(!4
5 5
, ( 1 5
5
Figure 2: Boxplot of elevation by landcover types in
the Spearfish region; the box widths represent the rel- As can be seen, these commands could be encap-
ative areal contributions of the landcover categories. sulated into a function, and the
,
file used to
!=
# !
) 2
4
)$!=
%!=# ' secure the correct projection data — these are steps
(
A
C@#
C#
';' that will occur as the spgrass6 package develops.
= @ =)$%) !)
!
= $%) !=
%!=# B Going a little further, a line layer showing stream
( !%
% ! * 6<=@# " =
I* +-./ centerlines can be moved to : , and converted to a
(
)I*
% 6* !=
# !
)
' 0 *>D
>8? @
8BH object:
F<@#,2
4I % @# 8'
A function
*>!
@ % @8 for moving numeric
) => =)#0 # !
%) *&!
raster layers to GRASS from : has also been pro- ( F<@# =
#*) # !
!*
!
'
vided; this uses E
/>8?E
and again the Arc ASCII (
,*
'
'
0#
2
4 # !
%86
) F<@#0 # !
86!
grid format, so care is needed to differentiate be-
(
,* 8;'
'
tween integer and floating point rasters if the first # !
2
406
1!H!F #
#
= ) #
* )
'
thousand data items appear to be integer.
>
# 8 # !
'
'!- $!2 0 (
$%(2/((/)%$%(2(3('$
Using the spgrass6 package with 0 039/)%(2$6
'/) '(1
vector data 3+"
5 "
5
3 "
5
5
* 3%0 $!2$9 , . /
Following suggestions by Miha Staut and others, 3%0 !23/)H & "! 3%0 #42'%$
some progress has been made on interfacing GRASS 3%0 !23/)& &"!1%0!)%$+ # "$
6 vector data. The package provides some skele- 3%0 !23/)& &"!(#
5
$
ton functions for reading and writing point data us- 3%0 !23/)& &"!
3
#
5
$
3%0 !23/)& &"!)
0 9$ '$
ing ASCII tables, but here we will look at using 3%0 !23/)& &"!)%(9&3/ 9 '# 0!)4 '$
ISSN 1614-8746 14
GRASS-News Vol. 3, June 2005
Having moved several layers into : , we can
<=@#
)%)5= !
= *# &=@#<<'
display them together by placing the streams and (* / "?
bugsites vector layers on the elevation raster layer: 2% $ 0!4)2 '/) '(1
0/)2 "%
" "%
/)%$
-0!4)9(3
$)23%0/9
(3$(
(
"%
" "%
Conclusion
The use of classes defined in the sp package will
make the construction of an interface between
GRASS 6 and : more robust than the legacy inter-
face. The new package will wrap @@D@!
!B calls to
Figure 3: Spearfish elevation map with stream cen- GRASS commands in : code to check and control the
terlines and bugsites. conversion process. Because the sp class objects have
or will soon have a range of display methods, and co-
$%)BI!)
!
= $%) ! != * #
#
!= =@# '
'
=)8 # !
!= * )>
!
%
% 3 * +-./ ' ersion methods to class types used in other packages
&=
!=
=@#%
>F ' 6 !* < for analysing spatial data, these do not need to be
( != * 7)# ! ! *
' part of the interface package. Reports on problems
and bugs, and suggestions for the interface package
Vector layers may be exported using functions may best be raised on the STATGRASS mailing list10 .
from the maptools package, and read in using Further work will attempt to streamline data transfer
'/) '(1 on GRASS 5.0 GIS data base files. Computers and Geosciences, 26,
1
5
""5 1043–1052.
"
5
""5
* 3%0 $!2$9 , . / Grohmann, C. H., (2004) Morphometric analysis in geographic in-
3%0 !23/)H & "! 3%0 #42'%$ formation systems: applications of free software GRASS and
3%0 !23/)H & &"!1%0!)%$+# "$ Computers and Geosciences, 30, 1055–1067.
3%0 !23/)H & &"!(#
5
$
3%0 !23/)H & &"!
3
#
5
$ Neteler, M. and Mitasova, H., (2004) Open Source GIS: A
3%0 !23/)H & &"!)
0 9$ '$ GRASS GIS Approach. Second Edition. Kluwer Academic
3%0 !23/)H & &"!)%(9&3/9 '# 0!)4 '$ Publishers/Springer, Dordrecht.
) 4!'-%$3 0 0/) 2 6 "%
F<@#32
4 % @# 8'
Pebesma, E.J., (2004) Multivariable geostatistics in S: the gstat
) =)# 4!=0%) *&! F<@#
( => 8> *)
)%)
'
#*)
)%) 3 !* &=
<!
(
5*
'
' Roger Bivand
Economic Geography Section, Department of Economics,
10 22
&3(
5 /2 5 /2!2(2&3(/)%9$1 5
ISSN 1614-8746 15
GRASS-News Vol. 3, June 2005
35464!798;:<: 7 @
4 @ E 4
B
B
ISSN 1614-8746 16
GRASS-News Vol. 3, June 2005
image analysis until now, GRASS was used as a base A specific image band, known to contain a single-
platform to prepare these images prior processing in sensor error, is read in with the @!E
com-
other, more specific software packages. mand and assigned to an R object. In order to facil-
One of the problems to deal with is the occurrence itate identification of objects, two-component, low-
of detector failures of the Hyperion push-broom sen- ercase object names are used in the following man-
sor, resulting in black vertical streaks of 1-pixel width ner: the first name element consists of a single letter,
in certain image bands. This may affect the spectral used up from ’a’ in alphabetical order, and combined
analysis, if those black pixels are interpreted as real with a second, descriptive element, separated by a
reflectance values. period (e.g. c.matrix, a.vector, . . .). The characteris-
According to Barry (2001), this problem can be tics of the newly created object are checked using the
easily corrected by substitution of the erroneous @BB*@ , B* and D> B commands. Note, that
pixel column by one of the arithmetic mean of the the image band is imported as a numeric object of
two adjacent ones. As this requires addressing of type list, with no dimension.
individual column vectors out of the complete im-
; ;*4;+F;'.1 !"%;2'0 418065 9-!2 0(2C; .1'.;12
age matrix, the R statistical environment seems to be # # #
$8;<09!;!192<( 4# 6 1!1*( 4# 6 - .018<( 4# :
an excellent tool to deal with this task, because of its
; 2!*+;' 65;* ;+F ; .1:
vector- and object-based nature and the possibility of 1<.!!0( 9!;282 " +11
its tight coupling with GRASS (Bivand and Neteler, ;'.1 .;1 #6A&&/58 7 "'. .1" .*+18-!$
2000). ; 115,;*4;+F;'.1:
In the following section, a brief description of
G& 2/9!-!2'02
a correction procedure is given, showing elemental ; 1- 5;D4;+F;'.1:
steps of interaction between the two software pack- % +
ages:
Now, this dimensionless object has to be trans-
formed to a matrix corresponding to the image di-
Correction of single-detector errors mensions. This is achieved by first transforming
the list into a vector, and then reordering the ,
vec-
If the image is already imported into GRASS and tor into a matrix with the number of rows (
)
,
the problematic bands and pixel columns are identi- and columns ( ) of the corresponding region
fied, the correction procedure involves the following settings shown above. Care should be taken in speci-
steps: GRASS is invoked, selecting the correspond- fying >@
6I in the matrix creation step, forcing R to
ing location of the raw image bands (not georefer-
read in the values by first filling rows, not columns.
enced). General region settings have to be checked
and adjusted to the total image coverage (=
*>? ; =/1$ 0< !" *!.9-!2 6 0 5;*4;+F;'.1:
module). From within GRASS, at terminal level, R ; 1154 =/1$ 0<:
is started and the GRASS library is loaded in order
G& 2 .*+18-8$A2
to get some specific commands for tightly working ; 1- 5==/1$'0<:
with the GIS-software: % +
# #
- # <D* ;
; $D,;<08- !" ;<0!- 5= =/!1$'0< '+%+F
+ ##
; 9-!;' 65 # :
'+%$889 !!F( :
##
- # 1<./- '.+1'.0)/;<-8;+9812 - . 3 ; 1- 5$ ,;<0!- :
<0! '!;2!2D"<98<1<.0"D<& '-!2'$ G& D<7 6D87
Then, the GRASS environment settings are re- In order to control the correct importation, the er-
trieved with B and assigned to an object un- roneous column vector (in this case, column num-
ber 92), corresponding to the single-detector error, is
der R. The actual settings are controlled with the
printed out: the whole vector contains zero values.
@BB*@ command and compared with the re- The same procedure may be undertaken for the two
gion information formerly checked under the GRASS adjacent columns (91, 93), in order to verify that the
shell. error has a horizontal extent of only one pixel.
!"%!180;75C:
;
; $D,;<08- 6
;#2!*+;'65+A: G& <<<9)<9)<9)<9)<9<)9
;<0; 3! # ##)DD # +%
85&!6!6!;
6A& <<<9)<9)<9)<9)<9<)9
F-'0( 6D87 $889+*+.2 ;'.1 D<7 +F2
6
&& <<<9)<9)<9)<9)<9<)9
!8
(1F12'0"81!;2'0 ;'.!1 -!2D3 & 6D
'; .1 0(1 28+*!0("'.'!0( 3 & D Now, the values of column 92 are replaced by
12'0"<1;2'0 $'19!9 2!-!012 ;<!1.& *!.-'02 the arithmetic mean of those of the two adjacent
;'.1 2<+*0(" .<!0( & *!.-'02D columns, and the result is displayed.
ISSN 1614-8746 17
GRASS-News Vol. 3, June 2005
;#$D,;<08- 6 !"E5$D,;'0!- & + Final remarks
%
$D,;<08- !5 : 86
;#$D,;<08- 6
G& &A5!5& 6.& &6 &A56<& &A5D87 &/6<&&/7 /& 6A&/7 & &8& The capabilities that the R language offers for han-
= &&!7 &/6A&/7 &A5& 8& &A5!7!7 &A5 6<& A& 58&!& A& 58&!& dling more or less complex arrays, makes it an inter-
esting tool complementing the GRASS GIS capabil-
!!
ities when individual image elements are to be ad-
For reconverting the matrix into a GRASS raster dressed. The integration of R into the GIS environ-
file, the matrix needs to be transposed ( =
BD*> ) ment by means of the specific GRASS library pro-
because of the reading order conventions of R, then vides the base for a smooth interaction of both soft-
transformed to a vector with the length of the total ware environments.
number of pixels (
! ) and converted to in-
The export from R has to be followed by a Bivand, R. and Neteler, M. 2000. Open Source geocompu-
=
procedure on the GRASS side in order to tation: using the R data analysis language integrated with
GRASS GIS and PostgreSQL data base systems. In: Pro-
ensure that pixel values are taken as integers. Herein, ceedings of the 5th International Conference on GeoCom-
the original cell values are given in comma-style, putation. University of Greenwich, Medway Campus, UK.
22
3$!4 56)
56)0
&&
5 2'
whereas the output values are specified as integers .
only. The GRASS raster file may now be visually
checked and processed in further analysis. Ihaka, Ross and Gentleman, Robert. 1996. R: A Language for Data
Analysis and Graphics. Journal of Computational and Graphi-
A possible drawback in this procedure may be cal Statistics 5:299–314.
the file size of the image band, as R-objects are
loaded completely in the memory space (Bivand and
Neteler, 2000). In order to reduce memory require- Guido Lorenz
ments to a minimum, a small region of interest, Facultad de Ciencias Forestales
which encompasses only a few columns, may be de- Universidad Nacional de Santiago del Estero
fined on the GRASS side (E
*>? ), prior to read Av. Belgrano (S) 1912
the image into R. After the correction procedure, the 4200 Santiago del Estero
new, corrected section is merged with the old image Argentina
band by means of the E
B*
command.
? C
G<IE@
!B
ISSN 1614-8746 18
GRASS-News Vol. 3, June 2005
ISSN 1614-8746 19
GRASS-News Vol. 3, June 2005
ISSN 1614-8746 20
GRASS-News Vol. 3, June 2005
Unfortunately, r.infer did not undergo similar up- F. Puppe (1993) Systematic Introduction to Expert Systems.
grading and enhancement other GRASS modules Springer.
did. Because of this it contains anachronisms such
J. Westervelt (1991)
as being limited to integer values and lacking NULL "%!"%GRASS
4.0
Inference
""Engine
"% r.infer.
. CERL.
support, requiring pre- and postprocessing by other
modules. With some effort r.mapcalc “IF-structures”
can be used to mimic most basic inference processes. Dr.Peter Loewe
Despite these shortcomings, the simplicity of the Geomancers.net
r.infer inference engine makes it a good starting point
8B*? D@
,?
to demonstrate the basic aspects of expert systems.
H
G<I
!BD? @
,?
Quantum GIS
Whats New in Version 0.7
Introduction
New Features
Projection Support
ISSN 1614-8746 21
GRASS-News Vol. 3, June 2005
Enhancements
Version 0.7 includes enhancements and changes to
existing features in QGIS. While we can’t list them
all, some of the major changes are:
PostgreSQL/PostGIS - Handling of spatially en-
abled tables and views in PostgreSQL has been
greatly improved. QGIS can now load any ta-
ble in the database that contains a geometry
column, regardless of whether the table has an
entry in the geometry_columns table. In addi-
tion, views that contain a spatial column can
now be loaded as well.
Raster graphing tool - It is now possible to produce
a histogram for a raster layer.
Raster query - Using the identify tool, you can now
get the pixel values from a raster by making it
the active layer and clicking on the point of in-
terest.
User preferences - New customizable settings for
Figure 2: GRASS tools in QGIS the digitizing line width, color, and selection
color.
Adding a tool (module) to the toolbox is done
by simply creating an XML configuration file that New symbols - New symbols for use with point lay-
defines the tool and options required to execute it. ers are available from the layer properties dia-
Each module also requires an icon and a record in log
the menu configuration file.
Spatial bookmarks - This feature allows you to cre-
ate and manage bookmarks for an area on the
map. Bookmarks are persistent and global;
Map Composer
meaning they are available for all projects.
The map composer (fig. 3) is a new feature that pro- Measure tool - Allows you to measure distances on
vides improved layout and printing capabilities. The the map with both segment length and total
composer allows you to add elements such as the length displayed as you click
QGIS map canvas, legend, scalebar, and text. You
can size and position each item and adjust the prop- GPX loading - Loading times and memory con-
erties to create your layout. The result can be printed, sumption for large GPX (GPS) files has been
exported as an image, or exported to SVG. drastically reduced.
ISSN 1614-8746 22
GRASS-News Vol. 3, June 2005
News
sion of the original GRASS make system.
From the user’s point of view, using GEM to in-
stall a GRASS 6 extension is a greatly simplified pro-
GRASS 6 Extensions Manager in cess. GEM can hide the details of source code config-
development uration and compilation from the user but will still
output meaningful error messages if something goes
A brief description of the current state of wrong. GEM can do the following things for the
user:
GEM
compile and install extensions stored in a direc-
The GRASS 6 Extension Manager (GEM) is a small tory or a compressed package (tar.gz, tar.bz2,
stand-alone program intended to make it easy for zip) provided that tar, gzip and friends are
users to download, compile and install additional available;
GRASS modules. GEM manages source code, scripts
and pre-compiled binaries in a simple file layout install pre-compiled binaries and scripts for
called an "extension". Extensions are accompanied different systems;
by a set of ASCII files that store all relevant infor-
retrieve extension packages from http and ftp
mation including dependencies on other extensions
sources, provided that wget is available;
or specific GRASS versions. Extensions can be stored
conveniently in a single compressed archive file, a so- query extensions to display information and li-
called "extension package" using external programs cense files;
such as tar and bzip2. An extension (package) can be
created easily by copying existing source codes into upgrade extensions;
the right places of a skeleton file layout and filling remove extensions from the system;
in some information in simple, commented ASCII
files. Makefiles written for GRASS 6 should work watch dependencies on other extensions and
with minimal changes as GEM uses a simplified ver- specific GRASS versions
ISSN 1614-8746 23
GRASS-News Vol. 3, June 2005
11 22
&3(
5 /2 5 /2!)%$#$22$3!0!2$30!)2$!2 5
ISSN 1614-8746 24
GRASS-News Vol. 3, June 2005
ISSN 1614-8746 25
GRASS-News Vol. 3, June 2005
We would like to express our sincere thanks to the 2. mutual and self-education
FOSS/GRASS 2004 International Organizing Com-
mittee for their support and the Conference Sec-
3. the bundling of knowledge
retariat at Chulalongkorn University for the excel-
lent arrangements that made it a pleasure to be in
Bangkok and enjoy the immense hospitality of the A regional user forum, the "SouthWest Germany
Thai people. We wish that the new friendships that GRASS User Forum", was established as a future
the FOSS/GRASS 2004 conference has so success- stage to showcase FOSS GIS projects. This forum will
fully initiated will help in incubating and nourishing be aimed at topics relating to real world applications.
new ideas and thereby enrich the FOSS community. Regular meetings were proposed for the future, start-
May the FOSS be with you ... ing in 2005. The next session will take place at the
Department of Physical Geography of the University
of Freiburg on 18./19.02.2005.
Dr. Venkatesh Raghavan
Osaka City University Dr. Sigrid Hess, Dipl.-Geogr. Marco Lechner and
Japan Dr. Peter Löwe; GAV e.V.
@@)6
>'?
Dr. Phisan Santitamnont @>< @@ G<I ?*>68B* ><? C=
Chulalongkorn University B*H
A !? G6I
>
??*>6 >+>=
Thailand
H
G<I
!BD? @
,?
ISSN 1614-8746 26
GRASS-News Vol. 3, June 2005
14 22
!### 5&$0&3( /$ 564)/73$/-4%3& 59%$/-%&!%$30)%$)$ )%$3'(3+0
&3(
ISSN 1614-8746 27
GRASS-News Vol. 3, June 2005
Editor-in-Chief:
Martin Wegmann
DLR – German Aerospace Center @
Remote Sensing and Biodiversity Unit
Dept. of Geography, University of Würzburg, Ger-
many
BIOTA-Project
?>*> /6 *>A
?>*>*>@
ISSN 1614-8746 28