/[thuban]/branches/WIP-pyshapelib-bramz/Doc/manual/thuban-manual.xml
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Doc/manual/thuban-manual.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1544 by jan, Mon Aug 4 15:22:48 2003 UTC revision 2688 by frank, Fri Jun 30 12:27:20 2006 UTC
# Line 2  Line 2 
2  <!DOCTYPE book  <!DOCTYPE book
3          PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"          PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
4          "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"          "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
5      [<!ENTITY imgscale "70">]>      [<!ENTITY imgscale "60">]>
6  <!-- $Revision$ -->  <!-- $Revision$ -->
7  <book>  <book>
8    <bookinfo>    <bookinfo>
9      <title>Thuban Manual</title>      <title>User's Manual for Thuban 1.0</title>
10      <author>          <authorgroup>
11        <firstname>Jonathan</firstname><surname>Coles</surname>        <author>
12      </author>          <firstname>Jonathan</firstname><surname>Coles</surname>
13      <author>        </author>
14        <firstname>Jan-Oliver</firstname><surname>Wagner</surname>        <author>
15      </author>          <firstname>Jan-Oliver</firstname><surname>Wagner</surname>
16      <author>        </author>
17        <firstname>Frank</firstname><surname>Koormann</surname>        <author>
18      </author>          <firstname>Frank</firstname><surname>Koormann</surname>
19          </author>
20            </authorgroup>
21      <copyright>      <copyright>
22        <year>2003</year>        <year>2003, 2004, 2005, 2006</year>
23        <holder>Intevation GmbH</holder>        <holder>Intevation GmbH</holder>
24      </copyright>      </copyright>
25       <revhistory>
26    <!-- comment this first revision out when releasing a real version -->
27         <revision>
28            <revnumber>SVN version $Id$</revnumber>
29            <date></date>
30            <revremark>Under development.</revremark>
31         </revision>
32         <revision>
33            <revnumber>1.0.0</revnumber>
34            <date>22-Jan-2004</date>
35            <revremark>
36                            Corresponds to Thuban 1.0.0.
37                            New: Installation instructions for Win32.
38                    </revremark>
39         </revision>
40         <revision>
41            <revnumber>1.0pre3</revnumber>
42            <date>04-Dec-2003</date>
43            <revremark>
44                            Corresponds to Thuban 1.0rc1.
45                            New: I18n, right button legend menu, EPSG projectons,
46                PostGIS support.
47                    </revremark>
48         </revision>
49         <revision>
50            <revnumber>1.0pre2</revnumber>
51            <date>29-Aug-2003</date>
52            <revremark>
53                            Corresponds to Thuban development release 0.8.1.
54                            New: chapter on extensions.
55                    </revremark>
56         </revision>
57         <revision>
58            <revnumber>1.0pre1</revnumber>
59            <date>08-Aug-2003</date>
60            <revremark>Corresponds to Thuban development release 0.8.1.</revremark>
61         </revision>
62      </revhistory>
63    
64    </bookinfo>    </bookinfo>
65    
66    <chapter><title>Introduction</title>    <chapter><title>Introduction</title>
67      <para>      <para>
68      Thuban is an interactive geographic data viewer.      Thuban is an interactive geographic data viewer.
69      It has been developed because there was no simple interactive      Its development had been started because there was no simple interactive
70      viewer for geographic information available as Free Software. Thuban is      viewer for geographic information available as Free Software. Thuban is
71      written in Python and C++ and uses the wxWindows library allowing it to      written mainly in Python and uses the wxWidgets (former wxWindows)
72        library allowing it to
73      run on many different platforms, including GNU/Linux and Windows.      run on many different platforms, including GNU/Linux and Windows.
74      </para>      </para>
75      <para>      <para>
# Line 41  Line 83 
83      </para>      </para>
84      <para>      <para>
85      Thuban arranges a session in a hierarchy. A session contains a map which      Thuban arranges a session in a hierarchy. A session contains a map which
86      consists of layers. Each layer represents one kind of data set. For      consists of layers. Each layer represents a data set. For
87      instance, there may be a layer for roads and another layer for buildings.      instance, there may be a layer for roads and another layer for buildings.
88      These layers can either be vector shapes or images.      These layers can either be vector shapes or images.
89      </para>      </para>
# Line 54  Line 96 
96          <ulink url="http://thuban.intevation.org/download.html">          <ulink url="http://thuban.intevation.org/download.html">
97          Thuban Download site          Thuban Download site
98          </ulink>.          </ulink>.
99            </para>
100            <para>
101            Required:
102            <itemizedlist>
103                <listitem><para>Python 2.2.1
104                            (<literal>http://www.python.org</literal>)
105                            </para></listitem>
106                <listitem><para>wxWindows 2.4
107                            (<literal>http://www.wxwindows.org</literal>)
108                            </para></listitem>
109                <listitem><para>wxPython 2.4
110                            (<literal>http://www.wxpython.org</literal>)
111                            </para></listitem>
112                <listitem><para>proj 4.4.5 Projection Library
113                            (<literal>http://www.remotesensing.org/proj/</literal>)
114                            </para></listitem>
115                <listitem><para>SQLite 2.8.3
116                            <literal>http://www.hwaci.com/sw/sqlite/</literal>)
117                            </para></listitem>
118                <listitem><para>PySQLite 0.4.3
119                            (<literal>http://pysqlite.sourceforge.net</literal>)
120                            </para></listitem>
121            </itemizedlist>
122            </para>
123            <para>
124            Optional:
125          <itemizedlist>          <itemizedlist>
126              <listitem><para>Python 2.2.1 (<literal>http://www.python.org</literal>)</para></listitem>              <listitem><para>GDAL 1.1.8
127              <listitem><para>wxWindows 2.4 (<literal>http://www.wxwindows.org</literal>)</para></listitem>                          (<literal>http://www.remotesensing.org/gdal/</literal>)
128              <listitem><para>wxPython 2.4 (<literal>http://www.wxpython.org</literal>)</para></listitem>                          </para></listitem>
129              <listitem><para>proj 4.4.5 Projection Library (<literal>http://www.remotesensing.org/proj/</literal>)</para></listitem>              <listitem><para>psycopg 1.0.8
130              <listitem><para>GDAL 1.1.8 (<literal>http://www.remotesensing.org/gdal/</literal>)</para></listitem>                          (<literal>http://initd.org/software/psycopg</literal>)
131              <listitem><para>SQLite 2.8.3 (<literal>http://www.hwaci.com/sw/sqlite/</literal>)</para></listitem>                          </para></listitem>
             <listitem><para>PySQLite 0.4.3 (<literal>http://pysqlite.sourceforge.net</literal>)</para></listitem>  
132              </itemizedlist>              </itemizedlist>
133          </para>          </para>
134                  <para>                  <para>
135                  Along with the source codes, the download page also offers                  Along with the source codes, the download page also offers full
136                  full installation packages for Debian, Windows and RPM-based systems                  installation packages for Debian, Windows and RPM-based systems
137                  (Mandrake, RedHat, SuSE, etc).                  (Mandrake, RedHat, SuSE, etc).
138                  </para>                  </para>
139                    <section><title>RPM-based GNU/Linux Systems</title>
140                            <section><title>Installing Binary Packages</title>
141                                    <para>
142                                    The most wide-spread RPM-based GNU/Linux
143                                    Systems are RedHat, Mandrake and SuSE.
144                                    The documentation of these distributions
145                                    should contain information about how to
146                                    install third-party RPM packages.
147                                    Nonetheless, a short summary is provided here.
148                                    </para>
149                                    <para>
150                                    RPM packages can be installed applying several
151                                    tools. The most basic one is the command line
152                                    program "rpm".  The hardware architecture is
153                                    identified in the name of RPM packages, eg.
154                                    'i386' for most Intel/AMD architectures.  
155                                    If you have a different hardware architecture,
156                                    where no binary RPM packages are provided,
157                                    you must rebuild binary packages from the
158                                    RPM source packages first (see below).
159                                    Typical rpm commands look like:
160    
161                                    <programlisting>
162                                    rpm --install Thuban-0.9.0-1.i386.rpm
163                                    </programlisting>
164    
165                                    Depending on what you already have installed
166                                    on your system, you are informed that some
167                                    packages are required, but not installed.
168                                    You need to install them first. Either they
169                                    are provided by your GNU/Linux distributor
170                                    or available somewhere on the Internet.  
171                                    The more essential and special ones are
172                                    provided together with the Thuban package.
173                                    </para>
174    
175                                    <para>
176                                    For rpm exist some graphical user interfaces, notably
177                                    kpackage, GnoRPM and xrpm.
178                                    </para>
179    
180                                    <para>
181                                    Make yourself familiar with one of the tools and apply it
182                                    to install the packages.
183                                    Note, that you need to be administrator (root) for the system
184                                    to do that.
185                                    </para>
186                            </section>
187                            <section><title>Build Binaries from Source Packages</title>
188                                    <para>
189                                    This section describes howto build RPM install-packages
190                                    from RPM source-packages.
191                                    This adapts and optimizes an install-package specifically
192                                    to your system.
193                                    This is especially helpful to resolve version conflicts of
194                                    dependent packages. Furthermore, install-packages for other
195                                    platforms (e.g. PowerPC) can be created.
196                                    </para>
197    
198                                    <para>
199                                    Note: rpm must be at least version 4. Execute
200                                    <literal>rpm --version</literal> to find out about the version.
201                                    </para>
202    
203                                    <para>
204                                    You need to do the following preparations to be able to
205                                    build the packages as a regular user. You should now
206                                    perform the package buling as root since this
207                                    might cause damage to your system.
208                            <itemizedlist>
209                            <listitem>
210                                                    <para>
211                                                    Create RPM directory structure:
212                                                    Choose a directory (e.g. $HOME/myrpm) and create the
213                                                    subdirectories BUILD, RPM, SOURCES, SPECS and SRPMS.
214                                                    A possible command sequence for this is:
215                                                    <programlisting>
216                                                    mkdir $HOME/freegisrpm
217                                                    cd $HOME/freegisrpm
218                                                    mkdir BUILD RPMS SOURCES SPECS SRPMS
219                                                    </programlisting>
220                                                    </para>
221                                            </listitem>
222                                            <listitem>
223                                                    <para>
224                                                    Set environment variable RPM_DIR:
225                                                    <programlisting>
226                                                    export RPM_DIR=$HOME/freegisrpm
227                                                    </programlisting>
228                                                    </para>
229                                            </listitem>
230                                            <listitem>
231                                                    <para>
232                                                    Create $HOME/.rpmmacros:
233                                                    This file sets general preferences and some
234                                                    specific settings for signing packages.
235                                                    If you don't have a GnuPG-key, you can skip
236                                                    the signature settings i.e. drop the last 4 lines.
237                                                    A signature becomes important when you want to
238                                                    give away packages to third parties.
239                                                    <programlisting>
240    <![CDATA[
241    %packager Name Lastname <[email protected]>
242    
243    %_topdir /home/mylogin/myrpm
244    
245    %_signature gpg
246    %_gpg_name Name Lastname
247    %_pgp_path ~/.gnupg
248    %_pgpbin /usr/bin/gpg
249    ]]>
250                                                    </programlisting>
251                                                    </para>
252                                            </listitem>
253                            </itemizedlist>
254    
255                                    Now you can install any RPM source-package.
256                                    It's components are installed into the corresponding
257                                    subdirectories of your rpm-directory.
258                                    Essentially these are the sources (into directory SOURCES)
259                                    and the so-called spec-file which contains all build
260                                    instructions. The spec-file will go into the SPEC directory.
261                                    Example:
262                                    <literal>rpm --install Thuban-0.9.0-1.src.rpm</literal>
263                                    </para>
264    
265                                    <para>
266                                    Create install-package:
267                                    Go to the directory with the spec-files and rebuild the
268                                    package:
269                                    <programlisting>
270    cd $HOME/mypm/SPECS
271    rpm -bb thuban.spec
272                                    </programlisting>
273                                    Next, you will find the newly created package in
274                                    $HOME/myrpm/RPMS/i386.
275                                    If you build the package for another architecture than
276                                    i386, then the name of the directory has a corresponding name.
277                                    </para>
278                                    <para>
279                                    For documentation of RPM, either type
280                                    <literal>man rpm</literal> or <literal>rpm --help</literal>.
281                                    This will provide you with information on the various command
282                                    line options of RPM.
283                                    For more information see the
284                            <ulink url="http://www.rpm.org/">homepage of RPM</ulink>.
285                                    </para>
286                            </section>
287                    </section> <!-- Intro - Installation - RPM-->
288    
289                    <section><title>Win32 Systems</title>
290                    <para>
291                            A common installation package of Thuban for Win32
292                            systems is available from the Thuban website download
293                            section. This installation package is configured for
294                            displaying file based vector data (Shapefiles). For the
295                            display of raster data or the connection to spatial
296                            databases additional steps are needed.  
297                    </para>
298                    <para>
299                            The required Python packages are listed and linked on
300                            the download page as well.  If you don't have Python
301                            installed already, download the packages for Python,
302                            wxPython for Python and the SQLite Python Libraries as
303                            well as the Thuban package. Install all four packages
304                            in the order: Python, wxPython, SQLite, Thuban. Follow
305                            the installation instructions provided by the seperate
306                            setups. The Thuban installation package will add an
307                            entry in the menu folder you configured.
308                    </para>
309                    <section><title>Raster Data: Installation of GDAL</title>
310                    <para>
311                            Enabling the raster data features of Thuban is
312                            straight forward. For the examples we assume that
313                            Thuban has been installed under
314                            <literal>C:\Thuban</literal>:
315                            <itemizedlist>
316                            <listitem>
317                            <para>
318                            Download the zip-archive <ulink
319                            url="ftp://intevation.de/thuban/win2k/gdal-win2k.zip"
320                            >gdal-win2k</ulink>.
321                            </para></listitem>
322                            <listitem><para>Extract the archive (e.g. with
323                            <ulink
324                            url="http://www.info-zip.org/pub/infozip/WiZ.html"
325                            >WiZ (InfoZip)</ulink>) into the
326                            <literal>C:\Thuban\Lib</literal>
327                            directory of your Thuban installation.
328                            </para>
329                            </listitem>
330                            <listitem>
331                            <para>
332                            Extent the <varname>PYTHONPATH</varname>
333                            environment variable (in your Windows Control Panel)
334                            to make the new libraries available for Thuban.
335                            <programlisting>
336    %PYTHONPATH%;C:\Thuban\Lib\gdal;C:\Thuban\Lib\gdal\pymod
337                            </programlisting>
338                            </para>
339                            </listitem>
340                            <listitem>
341                            <para>
342                            Extent also the <varname>PATH</varname>
343                            environment variable accordingly:
344                            <programlisting>
345    %PATH%;C:\Thuban\Lib\gdal
346                            </programlisting>
347                            </para>
348                            </listitem>
349                            </itemizedlist>
350                            After this installation steps Thuban is ready to
351                            display raster data (e.g. the
352                            <literal>island.tif</literal> from the Iceland Demo
353                            data set.
354                    </para>
355                    </section> <!-- Win32: GDAL-->
356    
357                    <section><title>Working with PostGIS: Installation of PsycoPG</title>
358                    <para>
359                            To access PostgreSQL/PostGIS spatial databases with
360                            Thuban you have to install the PsycoPG package for
361                            Windows:
362                            <itemizedlist>
363                            <listitem>
364                            <para>
365                            Download the zip-archive
366                            <ulink
367                                    url="http://stickpeople.com/projects/python/win-psycopg/win-psycopg22.zip"
368                            >win-psycopg22.zip</ulink>.
369                            </para>
370                            </listitem>
371                            <listitem>
372                            <para>
373                            Extract the zip-archive into a directory either already
374                            in your <varname>PYTHONPATH</varname> or extent your
375                            <varname>PYTHONPATH</varname> variable to the directory
376                            you have extracted the archive to.
377                            </para>
378                            </listitem>
379                            </itemizedlist>
380                            For installation and maintenance of spatial databases
381                            we refer to the  <ulink
382                            url="http://postgis.refractions.net"
383                            >PostGIS Homepage</ulink>.
384                    </para>
385                    </section> <!-- Win32: PsycoPG-->
386    
387                    </section> <!-- Intro - Installation - Win32 -->
388          </section>          </section>
389    
390            <section><title>Internationalization</title>
391            <para>
392            Thuban is implemented with internationalization support. So far Thuban
393            is translated by volunteers to the following languages (apart from its
394            main language: English):
395            <itemizedlist>
396                <listitem><para>French</para></listitem>
397                <listitem><para>German</para></listitem>
398                <listitem><para>Italian</para></listitem>
399                    <listitem><para>Portuguese (Brazilian)</para></listitem>
400                <listitem><para>Russian</para></listitem>
401                <listitem><para>Spanish</para></listitem>
402            </itemizedlist>
403            </para>
404    
405            <para>
406            To use internationalization under POSIX systems (like GNU/Linux)
407            you have to set the environment variable LC_ALL accordingly (e.g.
408            LC_ALL=fr_FR for the french language support). Please check your
409            systems documentation for details and supported settings.
410            Specifiying LC_ALL on the command line while launching thuban
411            allows appication specific language settings:
412            </para>
413            <programlisting>
414            LC_ALL=fr_FR thuban.py
415            </programlisting>
416    
417            <para>
418            MS Windows users have to specify the language to be used via the control
419            bar (which effects all applications).
420            </para>
421            </section>
422    
423          <section><title>The Main Window</title>          <section><title>The Main Window</title>
424          <para>          <para>
425          <figure>          <figure>
# Line 135  Line 484 
484          If a session is already loaded and has been modified without          If a session is already loaded and has been modified without
485          being saved a prompt will ask if the current session should          being saved a prompt will ask if the current session should
486          be saved. A new session consists of an empty map with no          be saved. A new session consists of an empty map with no
487          layers and no tables.          layers, no tables and no projection.
488          </para>          </para>
489          </section>          </section>
490    
# Line 149  Line 498 
498          for a Thuban Session file. Thuban session files end with          for a Thuban Session file. Thuban session files end with
499          <varname>.thuban</varname>. Selecting a file a clicking          <varname>.thuban</varname>. Selecting a file a clicking
500          <guibutton>OK</guibutton> will load the session into Thuban.          <guibutton>OK</guibutton> will load the session into Thuban.
501                    </para>
502    
503                    <para>
504          If a session is already loaded and has been modified without          If a session is already loaded and has been modified without
505          being saved a prompt will ask if the current session should          being saved a prompt will ask if the current session should
506          be saved.          be saved.
507          </para>          </para>
508                    
509                    <para>
510                    Thuban provides a path recovery feature: If a (shape) file referenced
511                    in a Thuban session cannot be found at the specified location, the user
512                    is prompted a file dialog. Here a new location can be selected for the
513                    currents layer data source. Cancelling the dialog removes the layer
514                    from the session. If a new location has been selected, Thuban checks
515                    this again, if further layers data sources are missing. The user is
516                    informed about this and can accept or cancel the suggestion.
517            </para>
518          </section>          </section>
519    
520          <section><title>Saving a Session</title>          <section><title>Saving a Session</title>
# Line 162  Line 523 
523          <menuchoice>          <menuchoice>
524          <guimenu>File</guimenu>          <guimenu>File</guimenu>
525          <guimenuitem>Save Session</guimenuitem>          <guimenuitem>Save Session</guimenuitem>
526          </menuchoice>. A dialog box will open allowing the user to browse          </menuchoice>.
527                    In the case the session is not a new and unsaved one,
528                    the corresponding file is updated with the current session
529                    data.
530                    In the case the current session is a new one and yet unsaved
531                    a dialog box will open allowing the user to browse
532          the file system and select a place to save the session. Thuban          the file system and select a place to save the session. Thuban
533          sessions should be saved under a name ending in          sessions should be saved under a name ending in
534          <varname>.thuban</varname>. If the file already exists the user          <varname>.thuban</varname>. If the file already exists the user
# Line 221  Line 587 
587    
588          <section><title>Adding and Removing Layers</title>          <section><title>Adding and Removing Layers</title>
589          <para>          <para>
590          There are two types of layers that can be added to a map: shape layers          There are three types of layers that can be added to a map:
591            Shape layers, database layers
592          and image layers. Shape layers are stored in Shapefile format, a          and image layers. Shape layers are stored in Shapefile format, a
593          standard file format for storing geographic objects. These          widely used file format for storing geographic objects. These
594          files have the extension ``.shp''. Associated with          files have the extension ``.shp''. Associated with
595          the shape file is a database file which stores attributes for          the shape file is a database file which stores attributes for
596          each shape in the shape file. This file, in dBase format,          each shape in the Shape file. This file, in dBase format,
597          has the extension ``.dbf''. Both files must have the same base name.          has the extension ``.dbf''. Both files must have the same base name.
598          For example, if there is a shape file named roads.shp there must          For example, if there is a shape file named roads.shp there must
599          also be a file roads.dbf.          also be a file roads.dbf.
600          </para>          </para>
601          <para>          <itemizedlist>
602            <listitem>
603            <para>
604          Shape layers can be added to the map with          Shape layers can be added to the map with
605          <menuchoice>          <menuchoice>
606          <guimenu>Map</guimenu>          <guimenu>Map</guimenu>
607          <guimenuitem>Add Layer</guimenuitem>          <guimenuitem>Add Layer</guimenuitem>
608          </menuchoice>.          </menuchoice>.
609          Thuban will load all files with the same base name, so it doesn't          Initially, only the ``.shp'' files are shown which is enough for the
610          matter if the shape file or database file is selected.                  selection. However, if you switch to display all files and select one
611                    of the associated files (e.g. ``.dbf''), Thuban will recognize the base
612                    name and load the corresponding Shape file.
613            </para>
614                    <para>
615                    The file dialog for Shape files allows to select multiple files.
616                    Use the shift-button together with the left mouse button to extend
617                    the selection.
618          </para>          </para>
619            </listitem>
620    
621            <listitem>
622            <para>Database layers can be added to the map with
623            <menuchoice>
624            <guimenu>Map</guimenu>
625            <guimenuitem>Add Database Layer</guimenuitem>
626            </menuchoice>.
627            A dialog with two lists is opened. The left list displays all
628            database connections currently open for the session. You can retrieve
629            a list of available layers from the selected database which is
630            displayed on the right hand. From this list one layer can be selected,
631            the dialog is closed afterwards.
632            </para>
633            <para>
634            See appendix ``Working with PostGIS'' for details.
635            </para>
636            </listitem>
637    
638            <listitem>
639          <para>          <para>
640          Image layers can be added to the map with          Image layers can be added to the map with
641          <menuchoice>          <menuchoice>
# Line 252  Line 647 
647          or in another file. If geographic information cannot be found, Thuban          or in another file. If geographic information cannot be found, Thuban
648          will report an error.          will report an error.
649          </para>          </para>
650            </listitem>
651            </itemizedlist>
652          </section>          </section>
653    
654          <section><title>Navigation</title>          <section><title>Navigation</title>
# Line 543  Line 940 
940          </para>          </para>
941          </listitem>          </listitem>
942          </itemizedlist>          </itemizedlist>
943    
944            <para>
945            The most used layer related actions are also available from a
946            popup menu. It is raised when a layer is clicked with the right mouse
947            button.
948            </para>
949            
950            <para>
951            <figure>
952            <title>Layer Popup Menu</title>
953            <mediaobject>
954            <imageobject><imagedata fileref="../images/3_5_popup_menu.png" format="PNG" scale="&imgscale;"/></imageobject>
955            <imageobject><imagedata fileref="./images/3_5_popup_menu.eps" format="EPS" scale="&imgscale;"/></imageobject>
956            </mediaobject>
957            </figure>
958            </para>
959    
960          <para>          <para>
961          Along the bottom of the legend is the scalebar. The scalebar          Along the bottom of the legend is the scalebar. The scalebar
962          will be available if there are any layers and the  map has a          will be available if there are any layers and the  map has a
# Line 587  Line 1001 
1001    
1002          <section><title>Types of Layers</title>          <section><title>Types of Layers</title>
1003          <para>          <para>
1004          There are two types of layers supported by Thuban: shape layers and          There are three types of layers supported by Thuban: shape layers,
1005            database layers and
1006          image layers. Shape layers consist of vector based shapes with          image layers. Shape layers consist of vector based shapes with
1007          geo-referenced coordinates. There are three types of supported          geo-referenced coordinates. There are three types of supported
1008          shapes: polygons, lines (arc), and points. Image layers can be any image          shapes: polygons, lines (arc), and points. Database layers are similar
1009            to shape layers but loaded from a database instead of the file system.
1010            Image layers can be any image
1011          file format supported by the Geo-spatial Data Abstraction Library          file format supported by the Geo-spatial Data Abstraction Library
1012          (GDAL). The images must have geographic          (GDAL). The images must have geographic
1013          coordinate data either embedded within the file or in a separate          coordinate data either embedded within the file or in a separate
# Line 775  Line 1192 
1192          <section><title>Value</title>          <section><title>Value</title>
1193              <para>              <para>
1194              The Value column of the classification table is the value that will              The Value column of the classification table is the value that will
1195              be matched when the map is being drawn. The type of data that can              be matched when the map is being drawn. The type of filter that can
1196              entered into this field depends on the type of data of the              entered into this field depends on the type of data of the
1197              classification field.              classification field:
1198              </para>              </para>
1199              <para>              <para>
1200              If the field is of type Text, anything entered              If the field is of type Text, anything entered
1201              into the field is valid. The text will be compared literally to the              into the field is valid. By default the text will be compared
1202              value of the shape attribute, including case sensitivity.              literally to the
1203                value of the shape attribute, including case sensitivity.
1204                Alternatively the comparison can be based on regular experessions.
1205                Right-click on the row label to open a popup menu with the options
1206                <guibutton>Singleton</guibutton> (literal comparison) and  
1207                <guibutton>Pattern</guibutton> (regular expressions).  
1208                </para>
1209                <para>
1210              If the type is Integer, then any valid integer may be entered. In              If the type is Integer, then any valid integer may be entered. In
1211              addition, with special syntax, a range of values can be entered.              addition, with special syntax, a range of values can be entered.
1212              A range from <varname>start</varname> to <varname>end</varname>              A range from <varname>start</varname> to <varname>end</varname>
# Line 793  Line 1217 
1217              Decimal. They represent any rational number and can be used in              Decimal. They represent any rational number and can be used in
1218              ranges as well.              ranges as well.
1219              </para>              </para>
1220              </section>         </section>
1221              <section><title>Label</title>              <section><title>Label</title>
1222              <para>              <para>
1223              By default, the text that is displayed for a group in the legend              By default, the text that is displayed for a group in the legend
# Line 922  Line 1346 
1346      </figure>      </figure>
1347      </para>      </para>
1348      <para>      <para>
1349      Thuban is distributed with a sample collection of projections. The      Thuban is distributed with a sample collection of projections and the
1350        set of coordinate systems as used by the EPSG
1351        (European Petroleum Survey Group). This quite large set is only displayed
1352        if activated by the according checkbox. The set falls into two parts:
1353        deprecated lists all projections which are no longer part of the
1354        EPSG data base.
1355        </para>
1356        <para>
1357             The
1358      user can create new projections and make them available to all      user can create new projections and make them available to all
1359      future Thuban sessions. They may also be exported and imported so      future Thuban sessions. They may also be exported and imported so
1360      that custom projections can be distributed.      that custom projections can be distributed.
# Line 1202  Line 1634 
1634      </section>      </section>
1635    </chapter>    </chapter>
1636    
1637      <chapter><title>Extensions</title>
1638            <para>
1639            Thuban is designed to be extensible. The term Extension is used as a
1640            general term for anything that extends Thuban.
1641            This chapter introduces into some oppportunities how to add and
1642            handle extra functionality developed by your own or third parties.
1643            </para>
1644    
1645            <section><title>Add personal extensions via thubanstart.py</title>
1646                    <para>
1647                    After Thuban has been started for the first time, a directory
1648                    .thuban is created within your home directory.
1649                    There you can add a file thubanstart.py  which will be imported
1650                    by Thuban at start-up. It is recommended to add only import-statements
1651                    to this file to keep the actual code of extensions separate.
1652                    </para>
1653                    <para>
1654                    The modules to import must either be found through the environment
1655                    variable PYTHONPATH or directly be placed into the .thuban-directory.
1656                    </para>
1657                    <para>
1658                    As an example, copy the file examples/simple_extensions/hello_world.py
1659                    of the Thuban source code into the .thuban-directory of your home
1660                    directory. Now add add the statement import hello_world to the
1661                    file thubanstart.py and run Thuban. You will notice an additional
1662                    menu <menuchoice><guimenu>Extensions</guimenu></menuchoice> where
1663                    the new item for the Hello-World extension is placed - select it
1664                    to see the Hello-World message.
1665                    </para>
1666            </section>
1667    
1668            <section><title>Extensions included in Thuban package</title>
1669                    <para>
1670                    The extensions described in this section are part of the
1671                    Thuban package, but not activated by default.
1672                    You will find them in the Thuban installation directory
1673                    under <literal>Extensions/</literal>. Activate them as personal
1674                    extensions via PYTHONPATH as described in the previous section.
1675                    Stable extensions will appear under the menu
1676                    <menuchoice><guimenu>Extensions</guimenu></menuchoice> and
1677                    extensions which are in experimental state and therefore
1678                    not fully functional under
1679                    <menuchoice><guimenu>Experimental</guimenu></menuchoice>.
1680                    </para>
1681    
1682                    <section><title>Stable extensions</title>
1683                        <para>
1684                        These extensions provide extra-functionality to Thuban
1685                        that has not (yet) been integrated in the main application.
1686                        They are considered to be free of bugs, but may be
1687                        further polished with helpful user interactions.
1688                        </para>
1689                        <section><title>gns2shp</title>
1690                                    <para>
1691                                    This tool converts data of the Geospatial Names Server
1692                                    (GNS, see <ulink url="http://www.nima.mil/gns"/>)
1693                                    into Shapefile format.
1694                                    The above web-site offer to download named places
1695                                    information grouped by countries for all of the world
1696                                    except USA for which other data are provided.
1697                                    </para>
1698                                    <para>
1699                                    If you download and unpack a package, you will have
1700                                    a text-file with suffix .txt.
1701                                    Selecting such a file via gns2shp will create the
1702                                    corresponding Shapefile with the same basename and
1703                                    place it in the same direcory. Afterwards it
1704                                    is automatically loaded into Thuban.
1705                                    The Shapefile will not automatically be delete afterwards.
1706                                    </para>
1707                                    <para>
1708                                    The gns2shp.py module can also be executed on the
1709                                    command line for batch processing purposes.
1710                                    </para>
1711                                    <para>
1712                                    A sample (<literal>ls.txt</literal> for Liechtenstein)
1713                                    is included in the directory
1714                                    <literal>Extensions/gns2shp/test</literal>.
1715                                    </para>
1716                        </section>
1717                        <section><title>SVG Export</title>
1718                            <para>
1719                            Map and legend can be exported separately in the
1720                            Thuban-Map-SVG format.
1721                            You get files that comply with
1722                            the Scalable Vector Graphics (SVG) 1.1 Specification
1723                            and can be read by many vector drawing applications.
1724                            </para>
1725                            <para>
1726                            Goal of svgexport is to provide
1727                            the start of a printing pipeline for Thuban.
1728                            For this purpose the written Thuban-Map-SVG files
1729                            contain information that can be used in postprocessing.
1730                            Typically a general vector drawing application is
1731                            more powerful then a geographic information viewer;
1732                            e.g. having much fancier symbols and fonts.
1733                            Also users benefit much more when learning to use a
1734                            more general application they can also use for other
1735                            tasks.  So the charming idea is to enable
1736                            the drawing application to postprocess a Thuban maps.
1737                            So thee xtra information in the format will make it
1738                            possible to export from Thuban and if a few geoobjects
1739                            change, and keep the general layout and style
1740                            of the full map in the vector drawing appplication.
1741                            </para>
1742                            <para>
1743                            Markus Rechtien has developed a prototype of this
1744                            printing pipline as his Diplom thetis, showing
1745                            the feasability of Bernhard Reiter's concept.
1746                            Scripts exist for the drawing application Skencil
1747                            (<ulink url="http://www.skencil.org"/>).
1748                            </para>
1749                            <para>
1750                            Technical notes: the names of the layers are used
1751                            as base for ids within the SVG format.
1752                            If you try to export with two layers having
1753                            the same name, you will get a name clash error.
1754                            Just change one of the layer names and try again.
1755                            </para>
1756                        </section>
1757                    </section>
1758                    <section><title>Experimental extensions</title>
1759                            <para>
1760                            All all of these functions have to be handled with care,
1761                            since they are neither complete nor well tested.
1762                            They are to be seen as a proof-of-concept and may
1763                            additionally in some cases of practical help.
1764                            </para>
1765                            <para>
1766                            Any interest on further improvement of these extensions
1767                            should be communicated towards the developer and user
1768                            community.
1769                            </para>
1770    
1771                            <section><title>importAPR</title>
1772                                    <para>
1773                                    This command offer to load an ESRI� ArcView� project
1774                                    file (suffix .apr) and convert it for use within Thuban.
1775                                    After selecting a apr-file to load, a list
1776                                    will be presented that offers to select one of the views
1777                                    of the apr-file, provided there is more than one.
1778                                    Furthermore, the Session Info-Tree is extended with
1779                                    a complete representation of the parsed apr-file.
1780                                    </para>
1781                                    <para>
1782                                    The legend of Thuban does not yet cover all of the elements as
1783                                    supported by the legend of ArcView�. Therefore, the Thuban
1784                                    map will look different. Furthermore, the apr-format is
1785                                    a proprietary format, not openly documented.
1786                                    Therefore, the interpretation is
1787                                    partly based on reverse engeneering and good guessing.
1788                                    </para>
1789                                    <para>
1790                                    The file-paths within the apr-file may not fit and potentially
1791                                    are subject to fix in the apr-file. You can do this
1792                                    applying any text editor. The paths are either absolute
1793                                    or relative from where Thuban has been started.
1794                                    </para>
1795                                    <para>
1796                                    A sample for the Iceland data is included as
1797                                    <literal>Extensions/importAPR/samples/iceland.apr</literal>.
1798                                    The file-paths are relative from the Thuban main directory.
1799                                    </para>
1800                            </section>
1801                    </section>
1802            </section>
1803    
1804            <section><title>Writing simple extensions</title>
1805                    <para>
1806                    Writing an extension for Thuban basically means to
1807                    implement the extra functionality in Python with all of the
1808                    Thuban classes, methods and variables available.
1809                    </para>
1810                    <para>
1811                    All classes and their methods are documented in the source code
1812                    (see their doc-strings). Here is an example from
1813                    Thuban/Model/layer.py that describes some of the methods
1814                    of a Layer object:
1815                    </para>
1816                    <programlisting>
1817                    <![CDATA[
1818    class BaseLayer(TitledObject, Modifiable):
1819    
1820        """Base class for the layers."""
1821    
1822        def __init__(self, title, visible = True, projection = None):
1823            """Initialize the layer.
1824    
1825            title -- the title
1826            visible -- boolean. If true the layer is visible.
1827            """
1828            TitledObject.__init__(self, title)
1829            Modifiable.__init__(self)
1830            self.visible = visible
1831            self.projection = projection
1832    
1833        def Visible(self):
1834            """Return true if layer is visible"""
1835            return self.visible
1836    
1837        def SetVisible(self, visible):
1838            """Set the layer's visibility."""
1839            self.visible = visible
1840            self.issue(LAYER_VISIBILITY_CHANGED, self)
1841    
1842        def HasClassification(self):
1843            """Determine if this layer support classifications."""
1844    ...
1845                    ]]>
1846                    </programlisting>
1847                    <para>
1848                    This example intends to give you an impression of the
1849                    source-code-level documentation.
1850                    You have to make yourself familiar with
1851                    the Python programming language to understand some special
1852                    code elements.
1853                    </para>
1854                    <section><title>hello_world.py</title>
1855                      <para>
1856                      Traditionally, the first example should welcome the world.
1857                      Most of the code handles the frame for integrating a menu
1858                      item into Thuban while the actual raising of a message
1859                      is done in a single line.
1860                      </para>
1861                            <programlisting>
1862                            <![CDATA[
1863    # Copyright (C) 2003 by Intevation GmbH
1864    # Authors:
1865    # Jan-Oliver Wagner <[email protected]>
1866    #
1867    # This program is free software under the GPL (>=v2)
1868    # Read the file COPYING coming with Thuban for details.
1869    
1870    """
1871    Extend Thuban with a sample Hello World to demonstrate simple
1872    extensions.
1873    """
1874    
1875    __version__ = '$Revision$'
1876    
1877    # use _() already now for all strings that may later be translated
1878    from Thuban import _
1879    
1880    # Thuban has named commands which can be registered in the central
1881    # instance registry.
1882    from Thuban.UI.command import registry, Command
1883    
1884    # The instance of the main menu of the Thuban application
1885    # See Thuban/UI/menu.py for the API of the Menu class
1886    from Thuban.UI.mainwindow import main_menu
1887    
1888    def hello_world_dialog(context):
1889        """Just raise a simple dialog to greet the world.
1890    
1891        context -- The Thuban context.
1892        """
1893        context.mainwindow.RunMessageBox(_('Hello World'), _('Hello World!'))
1894    
1895    
1896    # create a new command and register it
1897    registry.Add(Command('hello_world', _('Hello World'), hello_world_dialog,
1898                         helptext = _('Welcome everyone on this planet')))
1899    
1900    # find the extensions menu (create it anew if not found)
1901    extensions_menu = main_menu.FindOrInsertMenu('extensions', _('E&xtensions'))
1902    
1903    # finally bind the new command with an entry in the extensions menu
1904    extensions_menu.InsertItem('hello_world')
1905                            ]]>
1906                            </programlisting>
1907                    </section>
1908                    <section><title>Registering a Command</title>
1909                      <para>
1910                      Mainly, our new function has to be registered to the Thuban
1911                      framework in order to connect it to the menu. A registered
1912                      command can also be connected to e.g. a toolbar button.
1913                      </para>
1914                      <para>
1915                      The instances and classes for this are imported at the beginning.
1916                      Any code not inside a method or class is directly executed when
1917                      the source-code module is imported. Therefore, the second
1918                      part of this example consist of the plain statements to create a new
1919                      Command and to add it to the menu.
1920                      </para>
1921                      <para>
1922                      By convention, it looks for a menu registered as ``extensions'' to
1923                      insert the new command. If it does not exist yet, it gets created.
1924                      It is advisable to copy this code for any of your extensions.
1925                      </para>
1926                    </section>
1927                    <section><title>The Thuban context</title>
1928                            <para>
1929                            A registered command that is called, always receives the
1930                            Thuban context. This instance provides our method with
1931                            hook references to all important components of the Thuban
1932                            application.
1933                            </para>
1934                            <para>
1935                    In the example hello_world.py, our function uses the
1936                            mainwindow component which offers a method to raise a
1937                            message dialog. In total there are three hooks:
1938                            <itemizedlist>
1939                            <listitem>
1940                            <para>application:
1941                            This object is the instance of the Thuban Application class.
1942                            Except maybe for loading or savinf sessions, you will not
1943                            need this object for a simple extension.
1944                            See Thuban/UI/application.py for the API.
1945                            </para>
1946                            </listitem>
1947                            <listitem>
1948                            <para>session:
1949                            The instance of the current session. It manages the sessions'
1950                            map and tables. You can set and remove the map or tables.
1951                            In may also get the map object. However, you should know that
1952                            internally it is already prepared to handle many maps.
1953                            Therfore, currently you would always receive a list with exactlty
1954                            one element. In the future, if there are more than one map,
1955                            you will not know which one is the currently display one and
1956                            therefore you should use the mainwindow as hook to find
1957                            the currently displayed map.
1958                            See Thuban/Model/session.py for the API.
1959                            </para>
1960                            </listitem>
1961                            <listitem>
1962                            <para>
1963                            mainwindow: The mainwindow object is central to manage various
1964                            GUI things such as the Legend sub-window. Most notably,
1965                            you get access to the canvas which is the window part where
1966                            the map is drawn. The canvas knows, which map it currently
1967                            draws and therefore you get the current map via
1968                            context.mainwindow.canvas.Map().
1969                            See Thuban/UI/mainwindow.py for the API.
1970                            </para>
1971                            </listitem>
1972                            </itemizedlist>
1973                </para>
1974                    </section>
1975            </section>
1976      </chapter>
1977    
1978    <chapter><title>Trouble Shooting</title>    <chapter><title>Trouble Shooting</title>
1979      <para>      <para>
1980      Here are a few problems that users have encountered when first using Thuban.      Here are a few problems that users have encountered when first using Thuban.
# Line 1297  Line 2070 
2070      </varlistentry>      </varlistentry>
2071    
2072      <varlistentry>      <varlistentry>
2073        <term>PostGIS</term>
2074        <listitem>
2075            <para>
2076            PostGIS adds support for geographic objects to the PostgreSQL
2077            object-relational database. Different layer types (as for Shapefiles)
2078            are supported. <ulink url="http://postgis.refractions.net">PostGIS
2079            Homepage</ulink>
2080            </para>
2081        </listitem>
2082        </varlistentry>
2083    
2084        <varlistentry>
2085      <term>Raster files</term>      <term>Raster files</term>
2086      <listitem>      <listitem>
2087          <para>          <para>
# Line 1315  Line 2100 
2100      </variablelist>      </variablelist>
2101    </appendix>    </appendix>
2102    
2103      <appendix><title>Working with PostGIS</title>
2104      <para>
2105      This section focusses on the use of PostGIS in the Thuban framework. For
2106      installation and maintenance of spatial databases we refer to the  
2107      <ulink url="http://postgis.refractions.net">PostGIS Homepage</ulink>.
2108      The Thuban PostGIS support requires the
2109      <ulink url="http://initd.org/software/psycopg">psycopg module</ulink>.
2110      </para>
2111    
2112      <para>
2113            Working with PostGIS Databases is seperated into two steps:
2114            <itemizedlist>
2115            <listitem><para>Opening a Database Connection</para></listitem>
2116            <listitem><para>Loading a Data Layer</para></listitem>
2117            </itemizedlist>
2118      </para>
2119            <section><title>Opening a Database Connection</title>
2120            <para>
2121                    Before a data layer can be loaded from a PostGIS database a
2122                    connection with the database has to be established.
2123                    <menuchoice>
2124                    <guimenu>Session</guimenu>
2125                    <guimenuitem>Database Connections ...</guimenuitem>
2126                    </menuchoice> opens a dialog for database connection
2127                    management. In the dialog new connections can be added
2128                    and existing ones can be removed. Removing a database
2129                    connection is not possible if the map still displays a
2130                    layer provided by this database connection.
2131            </para>
2132        <figure>
2133        <title>Database Management Dialog</title>
2134        <mediaobject>
2135        <imageobject><imagedata fileref="../images/app_postgis_db_management.png" format="PNG" scale="&imgscale;"/></imageobject>
2136        <imageobject><imagedata fileref="./images/app_postgis_db_management.eps" format="EPS" scale="&imgscale;"/></imageobject>
2137        </mediaobject>
2138        </figure>
2139    
2140            <para>
2141                    To add a new database connection to the session a dialog is
2142                    opened to specify the relevant connection data. Enter all
2143                    data relevant for your connection. If the connection fails
2144                    the dialog remains open and provides some hints on the failure.
2145            </para>
2146            <figure>
2147            <title>Add Database Dialog</title>
2148            <mediaobject>
2149            <imageobject><imagedata fileref="../images/app_postgis_db_add.png" format="PNG" scale="&imgscale;"/></imageobject>
2150            <imageobject><imagedata fileref="./images/app_postgis_db_add.eps" format="EPS" scale="&imgscale;"/></imageobject>
2151            </mediaobject>
2152            </figure>
2153            
2154            <para>
2155            It is important to note that information on database connections are
2156            also stored with the session. Passwords are NOT stored. If you load a
2157            session with database connections you are asked to enter these
2158            passwords again where required.
2159            </para>
2160    
2161            </section>
2162    
2163            <section><title>Loading a Data Layer</title>
2164            <para>
2165            Data layers as part of a map are loaded with the
2166            <menuchoice>
2167            <guimenu>Map</guimenu>
2168            <guimenuitem>Add Database Layer ...</guimenuitem>
2169            </menuchoice> menu item. A dialog is raised displaying two choice
2170            lists. In the left list all connected databases are shown.
2171            Highlighting
2172            one of these and issuing a retrieval results in a list of available
2173            layer tables from that database. After selection of a
2174            layer the dialog is closed.
2175            </para>
2176            <figure>
2177            <title>Add Database Dialog</title>
2178            <mediaobject>
2179            <imageobject><imagedata fileref="../images/app_postgis_add_layer.png" format="PNG" scale="&imgscale;"/></imageobject>
2180            <imageobject><imagedata fileref="./images/app_postgis_add_layer.eps" format="EPS" scale="&imgscale;"/></imageobject>
2181            </mediaobject>
2182            </figure>
2183            
2184            </section>
2185    
2186      </appendix>
2187    
2188    <appendix><title>Supported Projections</title>    <appendix><title>Supported Projections</title>
2189      <para>      <para>
2190      The following types of projections are directly support by      The following types of projections are directly support by

Legend:
Removed from v.1544  
changed lines
  Added in v.2688

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26