[GRASSweb-list]markus: web/grass51/tutorial network.html,NONE,1.1 osnabrueck_location.tar.gz,NONE,1.1

grass at intevation.de grass at intevation.de
Thu Apr 17 09:17:44 EDT 2003


Author: markus

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

Added Files:
	network.html osnabrueck_location.tar.gz 
Log Message:
draft network tutor added, very incomplete

--- NEW FILE: network.html ---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
   <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: Vector networking tutorial</title>
</head>
<body>

<!-- 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>
</td><td><H1>
GRASS 5.1: Vector networking tutorial
</H1></td></tr></table>
<!-- END OF HEADER -->

<hr>
<a href="index.html">Tutorial HOME</a> |
<a href="intro.html">Intro</a> |
<a href="demo.html">Demo LOCATION</a> |
<a href="geom_storage.html">Geometry management</a> |
<a href="attrib_storage.html">Attribute management</a> |
<a href="examples.html">Usage Examples</a> | <br>
<a href="troubleshooting.html">Troubleshooting</a> |
<a href="links.html">Links</a>
<hr>

<i><b>README:</b>
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>
<i>
These examples described here may work or not. You are kindly invited to
send us further examples and/or code bugfixes/enhancements.</i>

<hr>
<a name="toc"></a>
<ol>
<li><a href="#vnetiso">v.net.iso</a>
<li><a href="#vnetalloc">v.net.alloc</a>
<li><a href="#vnetsteiner">v.net.steiner</a>
<li><a href="#vnetsalesman">v.net.salesman</a>
</ol>

<p><table width="100%" cellpadding="3" border="0">
<tr><td align="left" bgcolor="#B0F0B0"><font color="#00000"><big><b>
<a name="vnetiso"></a>
Reachability of Schools: v.net.iso
<DIV ALIGN=right><a href="#toc">[UP]</a></DIV>
</b></big></font></td></tr></table>

Reachability of Schools (find better name)

<P>
We need a street map and a map of school locations.
A nice, free vector data set is <a href="http://frida.intevation.de">FRIDA</a>,
the vector map of <b>Osnabr&uuml;ck</b>, a city in northern Germany.<br>
After downloading the dataset (SHAPE files) and extracting the 
<a href="osnabrueck_location.tar.gz">related GRASS location</a>, we can start. Enter GRASS 5.1 with
that <tt>osnabrueck</tt> LOCATION and <tt>user1</tt> mapset.
<P>
Translation aid for the map names:
<ul>
<li>strassen: streets
<li>poi: points of interest
<li>gewaesser: water
<li>...flaechen:areas
</ul>

<h2>1. Import of SHAPE maps</h2>

The SHAPE registration with 'v.format' is one option, but only intended for 
visualization. Since we want to work with the data, we import them into GRASS 
with 'v.in.ogr'.<br>
[expert note: a virtual column 'cat' is added when in=map is SHAPE]
<P>

#line/point layers:
<div class="code"><pre> 
v.in.ogr dsn=/ssi0/ssi/neteler/grassdata/osnabrueck/maps output=strassen layer=strassen
v.in.ogr dsn=/ssi0/ssi/neteler/grassdata/osnabrueck/maps output=poi layer=poi
</div></pre>
<P>

#area layer:
<div class="code"><pre> 
v.in.ogr dsn=/ssi0/ssi/neteler/grassdata/osnabrueck/maps output=gewaesserflaechen layer=gewaesserflaechen
-> WARNING: 2. centroid found in area 30...etc
-> "WARNING: Area boundaries are not cleaned by this module. Run v.clean on
         imported vector on new map <gewaesserflaechen>."
</div></pre>

The module 'v.in.ogr' imports non-topological GIS formats into the topological
GRASS. This is relevant for areas, where boundaries are duplicated in the SHAPE
file. As suggested, we run 'v.clean' to make the imported map fully topological:
<div class="code"><pre> 
v.clean input=gewaesserflaechen output=gewaesserflaechen_clean tool=rmdupl,bpol
</div></pre>
No more errors appear.


<h2>1.b) Add new field to be able to assign two tables later  - DIRTY</h2>

Later we want to add two tables to the resulting map. For that we have
to create a new field (fields are internal ID columns to link attribute tables
to GRASS vector maps). By default a vector map has only one field. To add
a second field column in the map, we run:

<div class="code"><pre> 
v.category poi out=poi_2f field=2 op=add
#verify:
v.category poi_2f field=1,2 op=print  
-> field 1 == field 2
</div></pre>

<!-- MAYBE:
[delete 1st unused field]
[v.category poi_2f out= poi_2f1 field=1 op=del]
[v.db.connect ...]
-->

<h2>2. Extract school places from POI map (but the map with two fields)</h2>

<div class="code"><pre> 
v.extract in=poi_2f out=schools type=point where="poiName='Schule' or poiName='Schulen'"
   #TODO: Fix Usulaschule - SQL regex 
v.info schools
-> one dblink
v.category schools field=1,2 op=print
-> 2 fields
d.erase
d.vect strassen
d.vect schools disp=attr attr=poiName bgcolor=white bcolor=black
d.vect schools col=red icon=basic/diamond
</div></pre>

Now we have the schools extracted from the poi map.

<h2>3. Patch schools into streets map</h2>

<div class="code"><pre> 
v.patch in=strassen,schools out=streets_schools
v.info streets_schools
-> dblinks = 0
d.erase
d.vect streets_schools
d.vect streets_schools type=point col=red
</div></pre>

But the tables are not linked yet (v.patch won't do it for various reasons).

So we add the related two database tables to the patched map.
GRASS 5.1 allows us to connect two tables to the same map.
<b>NOTE:</b> <i>key</i> must be an integer column!<br>

Now we link the patched map to the DBF tables generated during the 'v.in.ogr'
import (which are in mapset/dbf/), we do not link to the original tables:

<div class="code"><pre> 
db.connect dr=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'
db.describe -c strassen
ncols:6
Column 1: cat
Column 2: strShapeID
Column 3: strID
Column 4: strTypID
Column 5: strSpuren
Column 6: strEbene
-> the 'cat' column was added by 'v.in.ogr'
</div></pre>

<div class="code"><pre> 
v.db.connect streets_schools dr=dbf data='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' \
  table=strassen field=1 key=cat

v.db.connect streets_schools dr=dbf data='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' \
  table=schools field=2 key=cat
v.db.connect -p streets_schools
</div></pre>
<P>

Display the patched map with the linked two tables:
<div class="code"><pre> 
d.erase
d.vect streets_schools
</div></pre>

Display attributes of second table (lfield=2):
<div class="code"><pre> 
d.vect streets_schools type=point col=red disp=attr attrcol=poiName lfield=2
d.what.vect streets_schools
</div></pre>
<P>
v.net.iso: TODO

Splits network to bands between cost isolines (direction from center).

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

Allocates subnets for nearest centers (direction from center).

TODO


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

Creates Steiner tree for the network and given terminals.

TODO

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

Creates a network cycle by connecting given nodes (Traveling salesman problem).

TODO

<hr>
<P>
Further <a href=links.html>Links</a> (related software, SQL reference etc).

<!-- FOOTER -->
<p>
<hr>
<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/04/17 13:17:41 $
</i></DIV>

</body>
</html>

--- NEW FILE: osnabrueck_location.tar.gz ---
(This appears to be a binary file; contents omitted.)





More information about the grass-web mailing list