[GRASSweb-list]markus: web/grass51/tutorial usa_demo.html,NONE,1.1 index.html,1.19,1.20

grass at intevation.de grass at intevation.de
Tue Aug 19 12:17:28 EDT 2003

Author: markus

Update of /grassrepository/web/grass51/tutorial
In directory doto:/tmp/cvs-serv26479

Modified Files:
Added Files:
Log Message:
new examples

--- NEW FILE: usa_demo.html ---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
   <DEFANGED_meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <DEFANGED_meta name="Author" content="Markus Neteler">
   <DEFANGED_link rel="stylesheet" type="text/css" href="../../sitestyle.css">
   <title>GRASS 5.1: Examples from US National Atlas</title>

<!-- HEADER -->
<table width=100%><tr><td width=80>
<A HREF="index.html">
<DEFANGED_IMG src="../../images/grass.smlogo.gif" alt="HOME" border="0" align=middle></A>
GRASS 5.1: Examples from US National Atlas
<!-- END OF HEADER -->

<a name="toc"></a>
<a href="index.html">Tutorial HOME</a> |
<a href="index.html#toc">Table of contents</a>

GRASS 5.1 is currently under development. It is neither complete (it still
contains only a few modules) nor it is intended for productional usage. 
Development releases are provided for people who want to help test, debug,
and improve GRASS 5.1. Knowing this, please read on.</i><br>
These examples described here may work or not. You are kindly invited to
send us further examples and/or code bugfixes/enhancements.</i>

<p><table width="100%" cellpadding="3" border="0">
<tr><td align="left" bgcolor="#B0F0B0"><font color="#00000"><big><b>
<a name="overlay"></a>
Getting the data
<DIV ALIGN=right><a href="#toc">[UP]</a></DIV>

In this section we want to play abit with the (new) GRASS vector capabilities. This section is
inspired by the paper 
"<a href="http://www-users.cs.umn.edu/~djugash/cs8701/final.html">A Benchmark for Spatial 
Database Teaching</a>" by Judy Djugash and Wei-Hsin Fu which focuses on the Open GIS Consortium's (OGC) 
Simple Features Implementation Specification.
The data sets are available from the 
<a href="http://nationalatlas.gov/mapit.html">National Atlas of the United States</a>, in
particular from the <a href="http://www.nationalatlas.gov/atlasftp.html">Map Layers Warehouse</a>
(this site is a dream for European GIS users).
We have to download following map layers:
<li>Cities and Towns (Point data)

First we have to create a GRASS location in decimal degrees on datum NAD83:
<div class="code"><pre>
LOCATION: nationalatlas
mapset: user1
database: /usr/local/share/grassdata

Please specify the coordinate system for location <nationalatlas>
   B   Latitude-Longitude
Please enter a one line description for location <nationalatlas>
> nationalatlas

Do you wish to specify a geodetic datum for this location?(y/n) [y] y

Please specify datum name

Now select Datum Transformation Parameters
# 6 Used in Default nad83 region

                         DEFINE THE DEFAULT REGION
                       ====== DEFAULT REGION =======
                       | NORTH EDGE:74:50N____     |
                       |                           |
            WEST EDGE  |                           |EAST EDGE
            169:15E___ |                           |62:00W____
                       | SOUTH EDGE:13:20N____     |
           PROJECTION: 3 (Latitude-Longitude)         ZONE: 0

                             GRID RESOLUTION
                                 East-West:     0:05______
                               North-South:     0:05______


The data sets are provided in SHAPE format as well as SDTS format. GRASS can read both:

A) Import of "Cities and Towns" as SHAPE file:
<div class="code"><pre>
v.in.ogr dsn=citiesx020.shp output=cities
v.db.connect -p cities
d.vect cities icon=basic/circle fcolor=red
One attribute table is connected to the geometry.

B) Import of "Cities and Towns" as SDTS file:
<div class="code"><pre>
v.in.ogr dsn=CITXCATD.DDF output=CITX
v.db.connect -p CITX
d.vect CITX icon=basic/circle fcolor=red
Four attribute tables are connected to the geometry (accessible via 'field').
NOTE: Due to the map/tables size zooming before running a query with 'd.what.vect' is recommended.

We continue to work with the SHAPE files. Import of the "States" map:
<div class="code"><pre>
v.in.ogr dsn=statesp020.shp output=states
d.vect map=states fcolor=255:255:220

<div class="code"><pre>
v.in.ogr dsn=statesp020.shp output=roads
d.vect map=roads where="FEATURE='Limited Access Highway   Toll Road' or FEATURE='Limited Access Highway'" col=blue

The maps imported so far look like this:<br>
<a href=images/usa_nationalatlas.png><DEFANGED_IMG src=images/usa_nationalatlas_small.jpg alt="GRASS USA National Atlas example"></a>

Ex 1) List the name and area of all the states that are adjacent to Minnesota in the State table.
<div class="code"><pre>
d.what.vect states
#see attribute table

v.extract input=states output=minnesota where=STATE='Minnesota'
TODO - implement touch operator

Ex 2) List all the states that Interstate Route 90 passes through:
TODO - implementation of cross operator

Ex 3) List all the cities, which are within 150 km of the Interstate Route 90 road.
<div class="code"><pre>
d.vect map=roads where="NAME='Interstate Route 90' or NAME='Interstate Route 90, US Route 395'" col=green
#incomplete: we need a LIKE operator or =~
v.extract input=roads output=interstate90 field=1 new=0 where="NAME='Interstate Route 90' or NAME='Interstate Route 90, US Route 395'"
#check if buffer means geodetic dist in Lat/Long:
v.buffer input=interstate90 output=interstate90_150km buffer=150000 tolerance=1
TODO - implementation of cross operator
Further <a href=links.html>Links</a> (related software, SQL reference etc).

<!-- FOOTER -->
<DIV ALIGN=right>&copy; 2003 Markus Neteler<br>
<a href="mailto:weblist at grass.itc.it">Comments</a> about this page | <a href="../../faq/index.html">FAQ</a> | <a href="../../download.html">Download</a> | <a href="../../support.html">Support</a> | <a href="../../gdp/index.html">Docs</a>  | <a href="../../grassdevel.html">Programming</a> | Back <a href=index.html>5.1 Tutorial Home</a><br>
<i>Last change:
$Date: 2003/08/19 16:17:25 $


Index: index.html
RCS file: /grassrepository/web/grass51/tutorial/index.html,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- index.html	14 Aug 2003 15:25:05 -0000	1.19
+++ index.html	19 Aug 2003 16:17:25 -0000	1.20
@@ -106,8 +106,9 @@
   <li><a href="network.html#vnetsalesman">v.net.salesman</a>
  <li><a href="vectoroverlay.html">Vector overlay/clipping examples</a>
+ <li><a href="usa_demo.html">Examples from US National Atlas</a>
 <li><a href="troubleshooting.html">Troubleshooting</a>
   <li><a href="troubleshooting.html#sqlnames">The SQL query is rejected (parse error)!</a>

More information about the grass-web mailing list