|
GRASS 5.7: A quick demo tour
|
Tutorial HOME |
Table of contents
README:
GRASS 5.7 is currently under development. In case the examples described here do
not work properly, you are kindly invited to send us further examples and/or
code bugfixes/enhancements.
First download the Sample GRASS 5.7
LOCATION which is used throughout this tutorial. (no longer existing)
The sample LOCATION "g51test" contains a script which demonstrates most
features of the new vector engine. To run this demo, start GRASS 5.7 with
the sample LOCATION "g51test-X" (X is the current version of the data set)
and the mapset "test". In the LOCATION directory you will find the
./tour shell script (example):
grass57 /home/username/grassdata51/g51test-8/test/
After entering GRASS, change into the LOCATION directory and start the demo
tour:
cd /home/username/grassdata51/g51test-8/
g.region -dp
./tour
The README file in this directory contains descriptions of the sample maps.
Note: If the tour fails at a certain step, the version of the "g51test-X"
LOCATION does not correspond to current GRASS 5.7 version as installed on
your computer. Be sure to use latest code and sample data set. If this
doesn't help: congratulations, you have found a bug. Please report it to the
development team.
Further tests - for GRASS experts
|
Who feels confident with GRASS (5.7) may try further tests
with following scripts in the same directory:
- ./io
- imports 'mcat' and 'multi' ascii files from PERMANENT mapset to current
mapset, export again and compare with original files. Original and exported
files should be identical.
- ./genet
- creates a 2D vector network "net" with attributes stored in a DBF file.
Display it with:
d.vect net
nviz el=dem vect=net
v.db.connect -p net
v.info net
- ./gen.big
- generate big ascii file. Usage:
./gen.big output=name [n=value] [type=] [attr=value] [ver=value] [shape=value]
with:
n: number of rows and columns (def.: 10)
type: primitive type (def.: "plbc", point, line, boundary, centroid)
attr: y/n write attributes (def.: y)
ver: GRASS 5/4 version (def.: 5)
shape: area shape: r - rectangles, s - suns (def.: r)
Example (takes a while, generates 100 * 100 = 10000 lines with 10000 areas
with circle shape and 10000 islands):
./gen.big output=bigmap n=100 shape=s
v.in.ascii in=bigmap out=bigmap
v.info bigmap
d.vect bigmap
d.zoom
d.vect bigmap display=shape,cat lcolor=green
- ./gen.long
- generates a long line (curve)
./gen.long output=name [npoints=value]
with:
npoints: number of vertices (def.: 1000000)
Example:
./gen.long output=longcurve npoints=10000
v.in.ascii in=longcurve out=longcurve
v.info longcurve
v.db.connect -p longcurve
g.region vect=longcurve -p
d.erase
d.vect longcurve
d.zoom
- ./bench
- comparison between two formats: native x PostGRASS (using PostGIS).
The script is taking an existing vector map, copies it to PostGRASS and
runs some benchmarks.
We must have the postgis.sql file in the current directory (or somewhere
else, then modify the -G argument). First we generate a big vector map
(first in ASCII, then we import into native GRASS format, the script is not
very fast), then we generate a PostGIS table suitable for PostGRASS (you to
specify the path to the postgis.sql file with -G):
./gen.big output=big n=100 shape=s
v.in.ascii in=big out=big
v.info big
d.vect big
pg.postgisdb -c pgis -h pgserver.itc.it -U postgres -G ./
Next we have to define the PostGRASS connection:
cd `g.gisenv GISDBASE`
cd `g.gisenv LOCATION_NAME`
cd `g.gisenv MAPSET`
mkdir -p vector/big.post
cd vector/big.post
There generate an ASCII file 'frmt' containing (update HOST and USER
appropriate):
FORMAT: postgis
HOST:pgserver.itc.it
USER:postgres
DATABASE: pgis
GEOM_TABLE: bigg
CAT_TABLE: bigc
And add an ASCII file 'head' containing:
ORGANIZATION: GRASS Development Team
DIGIT DATE: 1/6/2002
DIGIT NAME: radim
MAP NAME: big.post
MAP DATE: 2002
MAP SCALE: 10000
OTHER INFO: Big map
ZONE: 0
MAP THRESH: 0.500000
Finally we run the benchmark script:
will print a table similar to this example:
Benchmark native contra PostGIS with following number of vectors:
Number of points: 200000
Number of lines: 160000
Number of centroids: 40000
Number of areas: 40000
Number of islands: 40000
Action big big.post
import 60.177005 note remote machine
The other scripts stored in the LOCATION directory are internally used by
some demo scripts.
Further Links (related software, SQL reference etc).