/[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 1570 by jan, Fri Aug 8 17:09:02 2003 UTC revision 2209 by jan, Sun May 16 09:38:48 2004 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>
# Line 19  Line 19 
19        </author>        </author>
20          </authorgroup>          </authorgroup>
21      <copyright>      <copyright>
22        <year>2003</year>        <year>2003, 2004</year>
23        <holder>Intevation GmbH</holder>        <holder>Intevation GmbH</holder>
24      </copyright>      </copyright>
25     <revhistory>     <revhistory>
26    <!-- comment this first revision out when releasing a real version -->
27    <!--
28         <revision>
29            <revnumber>CVS version $Id$</revnumber>
30            <date></date>
31            <revremark>Under development.</revremark>
32         </revision>
33    -->
34         <revision>
35            <revnumber>1.0.0</revnumber>
36            <date>22-Jan-2004</date>
37            <revremark>
38                            Corresponds to Thuban 1.0.0.
39                            New: Installation instructions for Win32.
40                    </revremark>
41         </revision>
42         <revision>
43            <revnumber>1.0pre3</revnumber>
44            <date>04-Dec-2003</date>
45            <revremark>
46                            Corresponds to Thuban 1.0rc1.
47                            New: I18n, right button legend menu, EPSG projectons,
48                PostGIS support.
49                    </revremark>
50         </revision>
51         <revision>
52            <revnumber>1.0pre2</revnumber>
53            <date>29-Aug-2003</date>
54            <revremark>
55                            Corresponds to Thuban development release 0.8.1.
56                            New: chapter on extensions.
57                    </revremark>
58         </revision>
59       <revision>       <revision>
60          <revnumber>1.0pre1</revnumber>          <revnumber>1.0pre1</revnumber>
61          <date>08-Aug-2003</date>          <date>08-Aug-2003</date>
62          <revremark>Corresponds to Thuban development release 0.8.1</revremark>          <revremark>Corresponds to Thuban development release 0.8.1.</revremark>
63       </revision>       </revision>
64    </revhistory>    </revhistory>
65    
# Line 64  Line 97 
97          <ulink url="http://thuban.intevation.org/download.html">          <ulink url="http://thuban.intevation.org/download.html">
98          Thuban Download site          Thuban Download site
99          </ulink>.          </ulink>.
100            </para>
101            <para>
102            Required:
103            <itemizedlist>
104                <listitem><para>Python 2.2.1
105                            (<literal>http://www.python.org</literal>)
106                            </para></listitem>
107                <listitem><para>wxWindows 2.4
108                            (<literal>http://www.wxwindows.org</literal>)
109                            </para></listitem>
110                <listitem><para>wxPython 2.4
111                            (<literal>http://www.wxpython.org</literal>)
112                            </para></listitem>
113                <listitem><para>proj 4.4.5 Projection Library
114                            (<literal>http://www.remotesensing.org/proj/</literal>)
115                            </para></listitem>
116                <listitem><para>SQLite 2.8.3
117                            <literal>http://www.hwaci.com/sw/sqlite/</literal>)
118                            </para></listitem>
119                <listitem><para>PySQLite 0.4.3
120                            (<literal>http://pysqlite.sourceforge.net</literal>)
121                            </para></listitem>
122            </itemizedlist>
123            </para>
124            <para>
125            Optional:
126          <itemizedlist>          <itemizedlist>
127              <listitem><para>Python 2.2.1 (<literal>http://www.python.org</literal>)</para></listitem>              <listitem><para>GDAL 1.1.8
128              <listitem><para>wxWindows 2.4 (<literal>http://www.wxwindows.org</literal>)</para></listitem>                          (<literal>http://www.remotesensing.org/gdal/</literal>)
129              <listitem><para>wxPython 2.4 (<literal>http://www.wxpython.org</literal>)</para></listitem>                          </para></listitem>
130              <listitem><para>proj 4.4.5 Projection Library (<literal>http://www.remotesensing.org/proj/</literal>)</para></listitem>              <listitem><para>psycopg 1.0.8
131              <listitem><para>GDAL 1.1.8 (<literal>http://www.remotesensing.org/gdal/</literal>)</para></listitem>                          (<literal>http://initd.org/software/psycopg</literal>)
132              <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>  
133              </itemizedlist>              </itemizedlist>
134          </para>          </para>
135                  <para>                  <para>
136                  Along with the source codes, the download page also offers                  Along with the source codes, the download page also offers full
137                  full installation packages for Debian, Windows and RPM-based systems                  installation packages for Debian, Windows and RPM-based systems
138                  (Mandrake, RedHat, SuSE, etc).                  (Mandrake, RedHat, SuSE, etc).
139                  </para>                  </para>
140                    <section><title>RPM-based GNU/Linux Systems</title>
141                            <section><title>Installing Binary Packages</title>
142                                    <para>
143                                    The most wide-spread RPM-based GNU/Linux
144                                    Systems are RedHat, Mandrake and SuSE.
145                                    The documentation of these distributions
146                                    should contain information about how to
147                                    install third-party RPM packages.
148                                    Nonetheless, a short summary is provided here.
149                                    </para>
150                                    <para>
151                                    RPM packages can be installed applying several
152                                    tools. The most basic one is the command line
153                                    program "rpm".  The hardware architecture is
154                                    identified in the name of RPM packages, eg.
155                                    'i386' for most Intel/AMD architectures.  
156                                    If you have a different hardware architecture,
157                                    where no binary RPM packages are provided,
158                                    you must rebuild binary packages from the
159                                    RPM source packages first (see below).
160                                    Typical rpm commands look like:
161    
162                                    <programlisting>
163                                    rpm --install Thuban-0.9.0-1.i386.rpm
164                                    </programlisting>
165    
166                                    Depending on what you already have installed
167                                    on your system, you are informed that some
168                                    packages are required, but not installed.
169                                    You need to install them first. Either they
170                                    are provided by your GNU/Linux distributor
171                                    or available somewhere on the Internet.  
172                                    The more essential and special ones are
173                                    provided together with the Thuban package.
174                                    </para>
175    
176                                    <para>
177                                    For rpm exist some graphical user interfaces, notably
178                                    kpackage, GnoRPM and xrpm.
179                                    </para>
180    
181                                    <para>
182                                    Make yourself familiar with one of the tools and apply it
183                                    to install the packages.
184                                    Note, that you need to be administrator (root) for the system
185                                    to do that.
186                                    </para>
187                            </section>
188                            <section><title>Build Binaries from Source Packages</title>
189                                    <para>
190                                    This section describes howto build RPM install-packages
191                                    from RPM source-packages.
192                                    This adapts and optimizes an install-package specifically
193                                    to your system.
194                                    This is especially helpful to resolve version conflicts of
195                                    dependent packages. Furthermore, install-packages for other
196                                    platforms (e.g. PowerPC) can be created.
197                                    </para>
198    
199                                    <para>
200                                    Note: rpm must be at least version 4. Execute
201                                    <literal>rpm --version</literal> to find out about the version.
202                                    </para>
203    
204                                    <para>
205                                    You need to do the following preparations to be able to
206                                    build the packages as a regular user. You should now
207                                    perform the package buling as root since this
208                                    might cause damage to your system.
209                            <itemizedlist>
210                            <listitem>
211                                                    <para>
212                                                    Create RPM directory structure:
213                                                    Choose a directory (e.g. $HOME/myrpm) and create the
214                                                    subdirectories BUILD, RPM, SOURCES, SPECS and SRPMS.
215                                                    A possible command sequence for this is:
216                                                    <programlisting>
217                                                    mkdir $HOME/freegisrpm
218                                                    cd $HOME/freegisrpm
219                                                    mkdir BUILD RPMS SOURCES SPECS SRPMS
220                                                    </programlisting>
221                                                    </para>
222                                            </listitem>
223                                            <listitem>
224                                                    <para>
225                                                    Set environment variable RPM_DIR:
226                                                    <programlisting>
227                                                    export RPM_DIR=$HOME/freegisrpm
228                                                    </programlisting>
229                                                    </para>
230                                            </listitem>
231                                            <listitem>
232                                                    <para>
233                                                    Create $HOME/.rpmmacros:
234                                                    This file sets general preferences and some
235                                                    specific settings for signing packages.
236                                                    If you don't have a GnuPG-key, you can skip
237                                                    the signature settings i.e. drop the last 4 lines.
238                                                    A signature becomes important when you want to
239                                                    give away packages to third parties.
240                                                    <programlisting>
241    <![CDATA[
242    %packager Name Lastname <[email protected]>
243    
244    %_topdir /home/mylogin/myrpm
245    
246    %_signature gpg
247    %_gpg_name Name Lastname
248    %_pgp_path ~/.gnupg
249    %_pgpbin /usr/bin/gpg
250    ]]>
251                                                    </programlisting>
252                                                    </para>
253                                            </listitem>
254                            </itemizedlist>
255    
256                                    Now you can install any RPM source-package.
257                                    It's components are installed into the corresponding
258                                    subdirectories of your rpm-directory.
259                                    Essentially these are the sources (into directory SOURCES)
260                                    and the so-called spec-file which contains all build
261                                    instructions. The spec-file will go into the SPEC directory.
262                                    Example:
263                                    <literal>rpm --install Thuban-0.9.0-1.src.rpm</literal>
264                                    </para>
265    
266                                    <para>
267                                    Create install-package:
268                                    Go to the directory with the spec-files and rebuild the
269                                    package:
270                                    <programlisting>
271    cd $HOME/mypm/SPECS
272    rpm -bb thuban.spec
273                                    </programlisting>
274                                    Next, you will find the newly created package in
275                                    $HOME/myrpm/RPMS/i386.
276                                    If you build the package for another architecture than
277                                    i386, then the name of the directory has a corresponding name.
278                                    </para>
279                                    <para>
280                                    For documentation of RPM, either type
281                                    <literal>man rpm</literal> or <literal>rpm --help</literal>.
282                                    This will provide you with information on the various command
283                                    line options of RPM.
284                                    For more information see the
285                            <ulink url="http://www.rpm.org/">homepage of RPM</ulink>.
286                                    </para>
287                            </section>
288                    </section> <!-- Intro - Installation - RPM-->
289    
290                    <section><title>Win32 Systems</title>
291                    <para>
292                            A common installation package of Thuban for Win32
293                            systems is available from the Thuban website download
294                            section. This installation package is configured for
295                            displaying file based vector data (Shapefiles). For the
296                            display of raster data or the connection to spatial
297                            databases additional steps are needed.  
298                    </para>
299                    <para>
300                            The required Python packages are listed and linked on
301                            the download page as well.  If you don't have Python
302                            installed already, download the packages for Python,
303                            wxPython for Python and the SQLite Python Libraries as
304                            well as the Thuban package. Install all four packages
305                            in the order: Python, wxPython, SQLite, Thuban. Follow
306                            the installation instructions provided by the seperate
307                            setups. The Thuban installation package will add an
308                            entry in the menu folder you configured.
309                    </para>
310                    <section><title>Raster Data: Installation of GDAL</title>
311                    <para>
312                            Enabling the raster data features of Thuban is
313                            straight forward. For the examples we assume that
314                            Thuban has been installed under
315                            <literal>C:\Thuban</literal>:
316                            <itemizedlist>
317                            <listitem>
318                            <para>
319                            Download the zip-archive <ulink
320                            url="ftp://intevation.de/thuban/win2k/gdal-win2k.zip"
321                            >gdal-win2k</ulink>.
322                            </para></listitem>
323                            <listitem><para>Extract the archive (e.g. with
324                            <ulink
325                            url="http://www.info-zip.org/pub/infozip/WiZ.html"
326                            >WiZ (InfoZip)</ulink>) into the
327                            <literal>C:\Thuban\Lib</literal>
328                            directory of your Thuban installation.
329                            </para>
330                            </listitem>
331                            <listitem>
332                            <para>
333                            Extent the <varname>PYTHONPATH</varname>
334                            environment variable (in your Windows Control Panel)
335                            to make the new libraries available for Thuban.
336                            <programlisting>
337    %PYTHONPATH%;C:\Thuban\Lib\gdal;C:\Thuban\Lib\gdal\pymod
338                            </programlisting>
339                            </para>
340                            </listitem>
341                            <listitem>
342                            <para>
343                            Extent also the <varname>PATH</varname>
344                            environment variable accordingly:
345                            <programlisting>
346    %PATH%;C:\Thuban\Lib\gdal
347                            </programlisting>
348                            </para>
349                            </listitem>
350                            </itemizedlist>
351                            After this installation steps Thuban is ready to
352                            display raster data (e.g. the
353                            <literal>island.tif</literal> from the Iceland Demo
354                            data set.
355                    </para>
356                    </section> <!-- Win32: GDAL-->
357    
358                    <section><title>Working with PostGIS: Installation of PsycoPG</title>
359                    <para>
360                            To access PostgreSQL/PostGIS spatial databases with
361                            Thuban you have to install the PsycoPG package for
362                            Windows:
363                            <itemizedlist>
364                            <listitem>
365                            <para>
366                            Download the zip-archive
367                            <ulink
368                                    url="http://stickpeople.com/projects/python/win-psycopg/win-psycopg22.zip"
369                            >win-psycopg22.zip</ulink>.
370                            </para>
371                            </listitem>
372                            <listitem>
373                            <para>
374                            Extract the zip-archive into a directory either already
375                            in your <varname>PYTHONPATH</varname> or extent your
376                            <varname>PYTHONPATH</varname> variable to the directory
377                            you have extracted the archive to.
378                            </para>
379                            </listitem>
380                            </itemizedlist>
381                            For installation and maintenance of spatial databases
382                            we refer to the  <ulink
383                            url="http://postgis.refractions.net"
384                            >PostGIS Homepage</ulink>.
385                    </para>
386                    </section> <!-- Win32: PsycoPG-->
387    
388                    </section> <!-- Intro - Installation - Win32 -->
389          </section>          </section>
390    
391            <section><title>Internationalization</title>
392            <para>
393            Thuban is implemented with internationalization support. So far Thuban
394            is translated by volunteers to the following languages (apart from its
395            main language: English):
396            <itemizedlist>
397                <listitem><para>French</para></listitem>
398                <listitem><para>German</para></listitem>
399                <listitem><para>Italian</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    
414            <para>
415            MS Windows users have to specify the language to be used via the control
416            bar (which effects all applications).
417            </para>
418            </section>
419    
420          <section><title>The Main Window</title>          <section><title>The Main Window</title>
421          <para>          <para>
422          <figure>          <figure>
# Line 231  Line 567 
567    
568          <section><title>Adding and Removing Layers</title>          <section><title>Adding and Removing Layers</title>
569          <para>          <para>
570          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:
571            Shape layers, database layers
572          and image layers. Shape layers are stored in Shapefile format, a          and image layers. Shape layers are stored in Shapefile format, a
573          standard file format for storing geographic objects. These          widely used file format for storing geographic objects. These
574          files have the extension ``.shp''. Associated with          files have the extension ``.shp''. Associated with
575          the shape file is a database file which stores attributes for          the shape file is a database file which stores attributes for
576          each shape in the shape file. This file, in dBase format,          each shape in the Shape file. This file, in dBase format,
577          has the extension ``.dbf''. Both files must have the same base name.          has the extension ``.dbf''. Both files must have the same base name.
578          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
579          also be a file roads.dbf.          also be a file roads.dbf.
580          </para>          </para>
581          <para>          <itemizedlist>
582            <listitem>
583            <para>
584          Shape layers can be added to the map with          Shape layers can be added to the map with
585          <menuchoice>          <menuchoice>
586          <guimenu>Map</guimenu>          <guimenu>Map</guimenu>
587          <guimenuitem>Add Layer</guimenuitem>          <guimenuitem>Add Layer</guimenuitem>
588          </menuchoice>.          </menuchoice>.
589          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
590          matter if the shape file or database file is selected.                  selection. However, if you switch to display all files and select one
591                    of the associated files (e.g. ``.dbf''), Thuban will recognize the base
592                    name and load the corresponding Shape file.
593          </para>          </para>
594                    <para>
595                    The file dialog for Shape files allows to select multiple files.
596                    Use the shift-button together with the left mouse button to extend
597                    the selection.
598            </para>
599            </listitem>
600    
601            <listitem>
602            <para>Database layers can be added to the map with
603            <menuchoice>
604            <guimenu>Map</guimenu>
605            <guimenuitem>Add Database Layer</guimenuitem>
606            </menuchoice>.
607            A dialog with two is list is opened. The left list displays all
608            database connections currently open for the session. You can retrieve
609            a list of available layers from the selected database which is
610            displayed on the right hand. From this list one layer can be selected,
611            the dialog is closed afterwards.
612            </para>
613            <para>
614            See appendix ``Working with PostGIS'' for details.
615            </para>
616            </listitem>
617    
618            <listitem>
619          <para>          <para>
620          Image layers can be added to the map with          Image layers can be added to the map with
621          <menuchoice>          <menuchoice>
# Line 262  Line 627 
627          or in another file. If geographic information cannot be found, Thuban          or in another file. If geographic information cannot be found, Thuban
628          will report an error.          will report an error.
629          </para>          </para>
630            </listitem>
631            </itemizedlist>
632          </section>          </section>
633    
634          <section><title>Navigation</title>          <section><title>Navigation</title>
# Line 553  Line 920 
920          </para>          </para>
921          </listitem>          </listitem>
922          </itemizedlist>          </itemizedlist>
923    
924            <para>
925            The most used layer related actions are also available from a
926            popup menu. It is raised when a layer is clicked with the right mouse
927            button.
928            </para>
929            
930            <para>
931            <figure>
932            <title>Layer Popup Menu</title>
933            <mediaobject>
934            <imageobject><imagedata fileref="../images/3_5_popup_menu.png" format="PNG" scale="&imgscale;"/></imageobject>
935            <imageobject><imagedata fileref="./images/3_5_popup_menu.eps" format="EPS" scale="&imgscale;"/></imageobject>
936            </mediaobject>
937            </figure>
938            </para>
939    
940          <para>          <para>
941          Along the bottom of the legend is the scalebar. The scalebar          Along the bottom of the legend is the scalebar. The scalebar
942          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 597  Line 981 
981    
982          <section><title>Types of Layers</title>          <section><title>Types of Layers</title>
983          <para>          <para>
984          There are two types of layers supported by Thuban: shape layers and          There are three types of layers supported by Thuban: shape layers,
985            database layers and
986          image layers. Shape layers consist of vector based shapes with          image layers. Shape layers consist of vector based shapes with
987          geo-referenced coordinates. There are three types of supported          geo-referenced coordinates. There are three types of supported
988          shapes: polygons, lines (arc), and points. Image layers can be any image          shapes: polygons, lines (arc), and points. Database layers are similar
989            to shape layers but loaded from a database instead of the file system.
990            Image layers can be any image
991          file format supported by the Geo-spatial Data Abstraction Library          file format supported by the Geo-spatial Data Abstraction Library
992          (GDAL). The images must have geographic          (GDAL). The images must have geographic
993          coordinate data either embedded within the file or in a separate          coordinate data either embedded within the file or in a separate
# Line 932  Line 1319 
1319      </figure>      </figure>
1320      </para>      </para>
1321      <para>      <para>
1322      Thuban is distributed with a sample collection of projections. The      Thuban is distributed with a sample collection of projections and the
1323        set of coordinate systems as used by the EPSG
1324        (European Petroleum Survey Group). This quite large set is only displayed
1325        if activated by the according checkbox. The set falls into two parts:
1326        deprecated lists all projections which are no longer part of the
1327        EPSG data base.
1328        </para>
1329        <para>
1330             The
1331      user can create new projections and make them available to all      user can create new projections and make them available to all
1332      future Thuban sessions. They may also be exported and imported so      future Thuban sessions. They may also be exported and imported so
1333      that custom projections can be distributed.      that custom projections can be distributed.
# Line 1212  Line 1607 
1607      </section>      </section>
1608    </chapter>    </chapter>
1609    
1610      <chapter><title>Extensions</title>
1611            <para>
1612            Thuban is designed to be extensible. The term Extension is used as a
1613            general term for anything that extends Thuban.
1614            This chapter introduces into some oppportunities how to add and
1615            handle extra functionality developed by your own or third parties.
1616            </para>
1617    
1618            <section><title>Add personal extensions via thubanstart.py</title>
1619                    <para>
1620                    After Thuban has been started for the first time, a directory
1621                    .thuban is created within your home directory.
1622                    There you can add a file thubanstart.py  which will be imported
1623                    by Thuban at start-up. It is recommended to add only import-statements
1624                    to this file to keep the actual code of extensions separate.
1625                    </para>
1626                    <para>
1627                    The modules to import must either be found through the environment
1628                    variable PYTHONPATH or directly be placed into the .thuban-directory.
1629                    </para>
1630                    <para>
1631                    As an example, copy the file examples/simple_extensions/hello_world.py
1632                    of the Thuban source code into the .thuban-directory of your home
1633                    directory. Now add add the statement import hello_world to the
1634                    file thubanstart.py and run Thuban. You will notice an additional
1635                    menu <menuchoice><guimenu>Extensions</guimenu></menuchoice> where
1636                    the new item for the Hello-World extension is placed - select it
1637                    to see the Hello-World message.
1638                    </para>
1639            </section>
1640    
1641            <section><title>Extensions included in Thuban package</title>
1642                    <para>
1643                    The extensions described in this section are part of the
1644                    Thuban package, but not activated by default.
1645                    You will find them in the Thuban installation directory
1646                    under <literal>Extensions/</literal>. Activate them as personal
1647                    extensions via PYTHONPATH as described in the previous section.
1648                    Stable extensions will appear under the menu
1649                    <menuchoice><guimenu>Extensions</guimenu></menuchoice> and
1650                    extensions which are in experimental state and therefore
1651                    not fully functional under
1652                    <menuchoice><guimenu>Experimental</guimenu></menuchoice>.
1653                    </para>
1654    
1655                    <section><title>Stable extensions</title>
1656                            <para>
1657                            These extensions provide extra-functionality to Thuban
1658                            that has not (yet) been integrated in the main application.
1659                            They are considered to be free of bugs, but may be
1660                            further polished with helpful user interactions.
1661                            </para>
1662                            <section><title>gns2shp</title>
1663                                    <para>
1664                                    This tool converts data of the Geospatial Names Server
1665                                    (GNS, see <ulink url="http://www.nima.mil/gns"/>)
1666                                    into Shapefile format.
1667                                    The above web-site offer to download named places
1668                                    information grouped by countries for all of the world
1669                                    except USA for which other data are provided.
1670                                    </para>
1671                                    <para>
1672                                    If you download and unpack a package, you will have
1673                                    a text-file with suffix .txt.
1674                                    Selecting such a file via gns2shp will create the
1675                                    corresponding Shapefile with the same basename and
1676                                    place it in the same direcory. Afterwards it
1677                                    is automatically loaded into Thuban.
1678                                    The Shapefile will not automatically be delete afterwards.
1679                                    </para>
1680                                    <para>
1681                                    The gns2shp.py module can also be executed on the
1682                                    command line for batch processing purposes.
1683                                    </para>
1684                                    <para>
1685                                    A sample (<literal>ls.txt</literal> for Liechtenstein)
1686                                    is included in the directory
1687                                    <literal>Extensions/gns2shp/test</literal>.
1688                                    </para>
1689                            </section>
1690                    </section>
1691                    <section><title>Experimental extensions</title>
1692                            <para>
1693                            All all of these functions have to be handled with care,
1694                            since they are neither complete nor well tested.
1695                            They are to be seen as a proof-of-concept and may
1696                            additionally in some cases of practical help.
1697                            </para>
1698                            <para>
1699                            Any interest on further improvement of these extensions
1700                            should be communicated towards the developer and user
1701                            community.
1702                            </para>
1703    
1704                            <section><title>importAPR</title>
1705                                    <para>
1706                                    This command offer to load an ESRI� ArcView� project
1707                                    file (suffix .apr) and convert it for use within Thuban.
1708                                    After selecting a apr-file to load, a list
1709                                    will be presented that offers to select one of the views
1710                                    of the apr-file, provided there is more than one.
1711                                    Furthermore, the Session Info-Tree is extended with
1712                                    a complete representation of the parsed apr-file.
1713                                    </para>
1714                                    <para>
1715                                    The legend of Thuban does not yet cover all of the elements as
1716                                    supported by the legend of ArcView�. Therefore, the Thuban
1717                                    map will look different. Furthermore, the apr-format is
1718                                    a proprietary format, not openly documented.
1719                                    Therefore, the interpretation is
1720                                    partly based on reverse engeneering and good guessing.
1721                                    </para>
1722                                    <para>
1723                                    The file-paths within the apr-file may not fit and potentially
1724                                    are subject to fix in the apr-file. You can do this
1725                                    applying any text editor. The paths are either absolute
1726                                    or relative from where Thuban has been started.
1727                                    </para>
1728                                    <para>
1729                                    A sample for the Iceland data is included as
1730                                    <literal>Extensions/importAPR/samples/iceland.apr</literal>.
1731                                    The file-paths are relative from the Thuban main directory.
1732                                    </para>
1733                            </section>
1734                    </section>
1735            </section>
1736    
1737            <section><title>Writing simple extensions</title>
1738                    <para>
1739                    Writing an extension for Thuban basically means to
1740                    implement the extra functionality in Python with all of the
1741                    Thuban classes, methods and variables available.
1742                    </para>
1743                    <para>
1744                    All classes and their methods are documented in the source code
1745                    (see their doc-strings). Here is an example from
1746                    Thuban/Model/layer.py that describes some of the methods
1747                    of a Layer object:
1748                    </para>
1749                    <programlisting>
1750                    <![CDATA[
1751    class BaseLayer(TitledObject, Modifiable):
1752    
1753        """Base class for the layers."""
1754    
1755        def __init__(self, title, visible = True, projection = None):
1756            """Initialize the layer.
1757    
1758            title -- the title
1759            visible -- boolean. If true the layer is visible.
1760            """
1761            TitledObject.__init__(self, title)
1762            Modifiable.__init__(self)
1763            self.visible = visible
1764            self.projection = projection
1765    
1766        def Visible(self):
1767            """Return true if layer is visible"""
1768            return self.visible
1769    
1770        def SetVisible(self, visible):
1771            """Set the layer's visibility."""
1772            self.visible = visible
1773            self.issue(LAYER_VISIBILITY_CHANGED, self)
1774    
1775        def HasClassification(self):
1776            """Determine if this layer support classifications."""
1777    ...
1778                    ]]>
1779                    </programlisting>
1780                    <para>
1781                    This example intends to give you an impression of the
1782                    source-code-level documentation.
1783                    You have to make yourself familiar with
1784                    the Python programming language to understand some special
1785                    code elements.
1786                    </para>
1787                    <section><title>hello_world.py</title>
1788                      <para>
1789                      Traditionally, the first example should welcome the world.
1790                      Most of the code handles the frame for integrating a menu
1791                      item into Thuban while the actual raising of a message
1792                      is done in a single line.
1793                      </para>
1794                            <programlisting>
1795                            <![CDATA[
1796    # Copyright (C) 2003 by Intevation GmbH
1797    # Authors:
1798    # Jan-Oliver Wagner <[email protected]>
1799    #
1800    # This program is free software under the GPL (>=v2)
1801    # Read the file COPYING coming with Thuban for details.
1802    
1803    """
1804    Extend Thuban with a sample Hello World to demonstrate simple
1805    extensions.
1806    """
1807    
1808    __version__ = '$Revision$'
1809    
1810    # use _() already now for all strings that may later be translated
1811    from Thuban import _
1812    
1813    # Thuban has named commands which can be registered in the central
1814    # instance registry.
1815    from Thuban.UI.command import registry, Command
1816    
1817    # The instance of the main menu of the Thuban application
1818    # See Thuban/UI/menu.py for the API of the Menu class
1819    from Thuban.UI.mainwindow import main_menu
1820    
1821    def hello_world_dialog(context):
1822        """Just raise a simple dialog to greet the world.
1823    
1824        context -- The Thuban context.
1825        """
1826        context.mainwindow.RunMessageBox(_('Hello World'), _('Hello World!'))
1827    
1828    
1829    # create a new command and register it
1830    registry.Add(Command('hello_world', _('Hello World'), hello_world_dialog,
1831                         helptext = _('Welcome everyone on this planet')))
1832    
1833    # find the extensions menu (create it anew if not found)
1834    extensions_menu = main_menu.FindOrInsertMenu('extensions', _('E&xtensions'))
1835    
1836    # finally bind the new command with an entry in the extensions menu
1837    extensions_menu.InsertItem('hello_world')
1838                            ]]>
1839                            </programlisting>
1840                    </section>
1841                    <section><title>Registering a Command</title>
1842                      <para>
1843                      Mainly, our new function has to be registered to the Thuban
1844                      framework in order to connect it to the menu. A registered
1845                      command can also be connected to e.g. a toolbar button.
1846                      </para>
1847                      <para>
1848                      The instances and classes for this are imported at the beginning.
1849                      Any code not inside a method or class is directly executed when
1850                      the source-code module is imported. Therefore, the second
1851                      part of this example consist of the plain statements to create a new
1852                      Command and to add it to the menu.
1853                      </para>
1854                      <para>
1855                      By convention, it looks for a menu registered as ``extensions'' to
1856                      insert the new command. If it does not exist yet, it gets created.
1857                      It is advisable to copy this code for any of your extensions.
1858                      </para>
1859                    </section>
1860                    <section><title>The Thuban context</title>
1861                            <para>
1862                            A registered command that is called, always receives the
1863                            Thuban context. This instance provides our method with
1864                            hook references to all important components of the Thuban
1865                            application.
1866                            </para>
1867                            <para>
1868                    In the example hello_world.py, our function uses the
1869                            mainwindow component which offers a method to raise a
1870                            message dialog. In total there are three hooks:
1871                            <itemizedlist>
1872                            <listitem>
1873                            <para>application:
1874                            This object is the instance of the Thuban Application class.
1875                            Except maybe for loading or savinf sessions, you will not
1876                            need this object for a simple extension.
1877                            See Thuban/UI/application.py for the API.
1878                            </para>
1879                            </listitem>
1880                            <listitem>
1881                            <para>session:
1882                            The instance of the current session. It manages the sessions'
1883                            map and tables. You can set and remove the map or tables.
1884                            In may also get the map object. However, you should know that
1885                            internally it is already prepared to handle many maps.
1886                            Therfore, currently you would always receive a list with exactlty
1887                            one element. In the future, if there are more than one map,
1888                            you will not know which one is the currently display one and
1889                            therefore you should use the mainwindow as hook to find
1890                            the currently displayed map.
1891                            See Thuban/Model/session.py for the API.
1892                            </para>
1893                            </listitem>
1894                            <listitem>
1895                            <para>
1896                            mainwindow: The mainwindow object is central to manage various
1897                            GUI things such as the Legend sub-window. Most notably,
1898                            you get access to the canvas which is the window part where
1899                            the map is drawn. The canvas knows, which map it currently
1900                            draws and therefore you get the current map via
1901                            context.mainwindow.canvas.Map().
1902                            See Thuban/UI/mainwindow.py for the API.
1903                            </para>
1904                            </listitem>
1905                            </itemizedlist>
1906                </para>
1907                    </section>
1908            </section>
1909      </chapter>
1910    
1911    <chapter><title>Trouble Shooting</title>    <chapter><title>Trouble Shooting</title>
1912      <para>      <para>
1913      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 1307  Line 2003 
2003      </varlistentry>      </varlistentry>
2004    
2005      <varlistentry>      <varlistentry>
2006        <term>PostGIS</term>
2007        <listitem>
2008            <para>
2009            PostGIS adds support for geographic objects to the PostgreSQL
2010            object-relational database. Different layer types (as for Shapefiles)
2011            are supported. <ulink url="http://postgis.refractions.net">PostGIS
2012            Homepage</ulink>
2013            </para>
2014        </listitem>
2015        </varlistentry>
2016    
2017        <varlistentry>
2018      <term>Raster files</term>      <term>Raster files</term>
2019      <listitem>      <listitem>
2020          <para>          <para>
# Line 1325  Line 2033 
2033      </variablelist>      </variablelist>
2034    </appendix>    </appendix>
2035    
2036      <appendix><title>Working with PostGIS</title>
2037      <para>
2038      This section focusses on the use of PostGIS in the Thuban framework. For
2039      installation and maintenance of spatial databases we refer to the  
2040      <ulink url="http://postgis.refractions.net">PostGIS Homepage</ulink>.
2041      The Thuban PostGIS support requires the
2042      <ulink url="http://initd.org/software/psycopg">psycopg module</ulink>.
2043      </para>
2044    
2045      <para>
2046            Working with PostGIS Databases is seperated into two steps:
2047            <itemizedlist>
2048            <listitem><para>Opening a Database Connection</para></listitem>
2049            <listitem><para>Loading a Data Layer</para></listitem>
2050            </itemizedlist>
2051      </para>
2052            <section><title>Opening a Database Connection</title>
2053            <para>
2054                    Before a data layer can be loaded from a PostGIS database a
2055                    connection with the database has to be established.
2056                    <menuchoice>
2057                    <guimenu>Session</guimenu>
2058                    <guimenuitem>Database Connections ...</guimenuitem>
2059                    </menuchoice> opens a dialog for database connection
2060                    management. In the dialog new connections can be added
2061                    and existing ones can be removed. Removing a database
2062                    connection is not possible if the map still displays a
2063                    layer provided by this database connection.
2064            </para>
2065        <figure>
2066        <title>Database Management Dialog</title>
2067        <mediaobject>
2068        <imageobject><imagedata fileref="../images/app_postgis_db_management.png" format="PNG" scale="&imgscale;"/></imageobject>
2069        <imageobject><imagedata fileref="./images/app_postgis_db_management.eps" format="EPS" scale="&imgscale;"/></imageobject>
2070        </mediaobject>
2071        </figure>
2072    
2073            <para>
2074                    To add a new database connection to the session a dialog is
2075                    opened to specify the relevant connection data. Enter all
2076                    data relevant for your connection. If the connection fails
2077                    the dialog remains open and provides some hints on the failure.
2078            </para>
2079            <figure>
2080            <title>Add Database Dialog</title>
2081            <mediaobject>
2082            <imageobject><imagedata fileref="../images/app_postgis_db_add.png" format="PNG" scale="&imgscale;"/></imageobject>
2083            <imageobject><imagedata fileref="./images/app_postgis_db_add.eps" format="EPS" scale="&imgscale;"/></imageobject>
2084            </mediaobject>
2085            </figure>
2086            
2087            <para>
2088            It is important to note that information on database connections are
2089            also stored with the session. Passwords are NOT stored. If you load a
2090            session with database connections you are asked to enter these
2091            passwords again where required.
2092            </para>
2093    
2094            </section>
2095    
2096            <section><title>Loading a Data Layer</title>
2097            <para>
2098            Data layers as part of a map are loaded with the
2099            <menuchoice>
2100            <guimenu>Map</guimenu>
2101            <guimenuitem>Add Database Layer ...</guimenuitem>
2102            </menuchoice> menu item. A dialog is raised displaying two choice
2103            lists. In the left list all connected databases are shown.
2104            Highlighting
2105            one of these and issuing a retrieval results in a list of available
2106            layer tables from that database. After selection of a
2107            layer the dialog is closed.
2108            </para>
2109            <figure>
2110            <title>Add Database Dialog</title>
2111            <mediaobject>
2112            <imageobject><imagedata fileref="../images/app_postgis_add_layer.png" format="PNG" scale="&imgscale;"/></imageobject>
2113            <imageobject><imagedata fileref="./images/app_postgis_add_layer.eps" format="EPS" scale="&imgscale;"/></imageobject>
2114            </mediaobject>
2115            </figure>
2116            
2117            </section>
2118    
2119      </appendix>
2120    
2121    <appendix><title>Supported Projections</title>    <appendix><title>Supported Projections</title>
2122      <para>      <para>
2123      The following types of projections are directly support by      The following types of projections are directly support by

Legend:
Removed from v.1570  
changed lines
  Added in v.2209

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26