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> |
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.0pre3</revnumber> |
36 |
|
<date>04-Dec-2003</date> |
37 |
|
<revremark> |
38 |
|
Corresponds to Thuban 1.0rc1 |
39 |
|
New: I18n, right button legend menu, EPSG projectons, |
40 |
|
PostGIS support. |
41 |
|
</revremark> |
42 |
|
</revision> |
43 |
|
<revision> |
44 |
|
<revnumber>1.0pre2</revnumber> |
45 |
|
<date>29-Aug-2003</date> |
46 |
|
<revremark> |
47 |
|
Corresponds to Thuban development release 0.8.1. |
48 |
|
New: chapter on extensions. |
49 |
|
</revremark> |
50 |
|
</revision> |
51 |
<revision> |
<revision> |
52 |
<revnumber>1.0pre1</revnumber> |
<revnumber>1.0pre1</revnumber> |
53 |
<date>08-Aug-2003</date> |
<date>08-Aug-2003</date> |
54 |
<revremark>Corresponds to Thuban development release 0.8.1</revremark> |
<revremark>Corresponds to Thuban development release 0.8.1.</revremark> |
55 |
</revision> |
</revision> |
56 |
</revhistory> |
</revhistory> |
57 |
|
|
89 |
<ulink url="http://thuban.intevation.org/download.html"> |
<ulink url="http://thuban.intevation.org/download.html"> |
90 |
Thuban Download site |
Thuban Download site |
91 |
</ulink>. |
</ulink>. |
92 |
|
</para> |
93 |
|
<para> |
94 |
|
Required: |
95 |
<itemizedlist> |
<itemizedlist> |
96 |
<listitem><para>Python 2.2.1 (<literal>http://www.python.org</literal>)</para></listitem> |
<listitem><para>Python 2.2.1 (<literal>http://www.python.org</literal>)</para></listitem> |
97 |
<listitem><para>wxWindows 2.4 (<literal>http://www.wxwindows.org</literal>)</para></listitem> |
<listitem><para>wxWindows 2.4 (<literal>http://www.wxwindows.org</literal>)</para></listitem> |
98 |
<listitem><para>wxPython 2.4 (<literal>http://www.wxpython.org</literal>)</para></listitem> |
<listitem><para>wxPython 2.4 (<literal>http://www.wxpython.org</literal>)</para></listitem> |
99 |
<listitem><para>proj 4.4.5 Projection Library (<literal>http://www.remotesensing.org/proj/</literal>)</para></listitem> |
<listitem><para>proj 4.4.5 Projection Library (<literal>http://www.remotesensing.org/proj/</literal>)</para></listitem> |
|
<listitem><para>GDAL 1.1.8 (<literal>http://www.remotesensing.org/gdal/</literal>)</para></listitem> |
|
100 |
<listitem><para>SQLite 2.8.3 (<literal>http://www.hwaci.com/sw/sqlite/</literal>)</para></listitem> |
<listitem><para>SQLite 2.8.3 (<literal>http://www.hwaci.com/sw/sqlite/</literal>)</para></listitem> |
101 |
<listitem><para>PySQLite 0.4.3 (<literal>http://pysqlite.sourceforge.net</literal>)</para></listitem> |
<listitem><para>PySQLite 0.4.3 (<literal>http://pysqlite.sourceforge.net</literal>)</para></listitem> |
102 |
|
</itemizedlist> |
103 |
|
</para> |
104 |
|
<para> |
105 |
|
Optional: |
106 |
|
<itemizedlist> |
107 |
|
<listitem><para>GDAL 1.1.8 (<literal>http://www.remotesensing.org/gdal/</literal>)</para></listitem> |
108 |
|
<listitem><para>psycopg 1.0.8 (<literal>http://initd.org/software/psycopg</literal>)</para></listitem> |
109 |
</itemizedlist> |
</itemizedlist> |
110 |
</para> |
</para> |
111 |
<para> |
<para> |
113 |
full installation packages for Debian, Windows and RPM-based systems |
full installation packages for Debian, Windows and RPM-based systems |
114 |
(Mandrake, RedHat, SuSE, etc). |
(Mandrake, RedHat, SuSE, etc). |
115 |
</para> |
</para> |
116 |
|
<section><title>RPM-based GNU/Linux Systems</title> |
117 |
|
<section><title>Installing Binary Packages</title> |
118 |
|
<para> |
119 |
|
The most wide-spread RPM-based GNU/Linux Systems are RedHat, |
120 |
|
Mandrake and SuSE. The documentation of these distributions |
121 |
|
should contain information about how to install third-party |
122 |
|
RPM packages. Nonetheless, a short summary is provided here. |
123 |
|
</para> |
124 |
|
<para> |
125 |
|
RPM packages can be installed applying several tools. |
126 |
|
The most basic one is the command line program "rpm". |
127 |
|
The hardware architecture is identified in the name |
128 |
|
of RPM packages, eg. 'i386' for most Intel/AMD architectures. |
129 |
|
If you have a different hardware architecture, where no |
130 |
|
binary RPM packages are provided, you must rebuild binary |
131 |
|
packages from the RPM source packages first (see below). |
132 |
|
Typical rpm commands look like: |
133 |
|
|
134 |
|
<programlisting> |
135 |
|
rpm --install Thuban-0.9.0-1.i386.rpm |
136 |
|
</programlisting> |
137 |
|
|
138 |
|
Depending on what you already have installed on your |
139 |
|
system, you are informed that some packages are |
140 |
|
required, but not installed. You need to install them |
141 |
|
first. Either they are provided by your GNU/Linux distributor |
142 |
|
or available somewhere on the Internet. |
143 |
|
The more essential and special ones are provided together |
144 |
|
with the Thuban package. |
145 |
|
</para> |
146 |
|
|
147 |
|
<para> |
148 |
|
For rpm exist some graphical user interfaces, notably |
149 |
|
kpackage, GnoRPM and xrpm. |
150 |
|
</para> |
151 |
|
|
152 |
|
<para> |
153 |
|
Make yourself familiar with one of the tools and apply it |
154 |
|
to install the packages. |
155 |
|
Note, that you need to be administrator (root) for the system |
156 |
|
to do that. |
157 |
|
</para> |
158 |
|
</section> |
159 |
|
<section><title>Build Binaries from Source Packages</title> |
160 |
|
<para> |
161 |
|
This section describes howto build RPM install-packages |
162 |
|
from RPM source-packages. |
163 |
|
This adapts and optimizes an install-package specifically |
164 |
|
to your system. |
165 |
|
This is especially helpful to resolve version conflicts of |
166 |
|
dependent packages. Furthermore, install-packages for other |
167 |
|
platforms (e.g. PowerPC) can be created. |
168 |
|
</para> |
169 |
|
|
170 |
|
<para> |
171 |
|
Note: rpm must be at least version 4. Execute |
172 |
|
<literal>rpm --version</literal> to find out about the version. |
173 |
|
</para> |
174 |
|
|
175 |
|
<para> |
176 |
|
You need to do the following preparations to be able to |
177 |
|
build the packages as a regular user. You should now |
178 |
|
perform the package buling as root since this |
179 |
|
might cause damage to your system. |
180 |
|
<itemizedlist> |
181 |
|
<listitem> |
182 |
|
<para> |
183 |
|
Create RPM directory structure: |
184 |
|
Choose a directory (e.g. $HOME/myrpm) and create the |
185 |
|
subdirectories BUILD, RPM, SOURCES, SPECS and SRPMS. |
186 |
|
A possible command sequence for this is: |
187 |
|
<programlisting> |
188 |
|
mkdir $HOME/freegisrpm |
189 |
|
cd $HOME/freegisrpm |
190 |
|
mkdir BUILD RPMS SOURCES SPECS SRPMS |
191 |
|
</programlisting> |
192 |
|
</para> |
193 |
|
</listitem> |
194 |
|
<listitem> |
195 |
|
<para> |
196 |
|
Set environment variable RPM_DIR: |
197 |
|
<programlisting> |
198 |
|
export RPM_DIR=$HOME/freegisrpm |
199 |
|
</programlisting> |
200 |
|
</para> |
201 |
|
</listitem> |
202 |
|
<listitem> |
203 |
|
<para> |
204 |
|
Create $HOME/.rpmmacros: |
205 |
|
This file sets general preferences and some |
206 |
|
specific settings for signing packages. |
207 |
|
If you don't have a GnuPG-key, you can skip |
208 |
|
the signature settings i.e. drop the last 4 lines. |
209 |
|
A signature becomes important when you want to |
210 |
|
give away packages to third parties. |
211 |
|
<programlisting> |
212 |
|
<![CDATA[ |
213 |
|
%packager Name Lastname <[email protected]> |
214 |
|
|
215 |
|
%_topdir /home/mylogin/myrpm |
216 |
|
|
217 |
|
%_signature gpg |
218 |
|
%_gpg_name Name Lastname |
219 |
|
%_pgp_path ~/.gnupg |
220 |
|
%_pgpbin /usr/bin/gpg |
221 |
|
]]> |
222 |
|
</programlisting> |
223 |
|
</para> |
224 |
|
</listitem> |
225 |
|
</itemizedlist> |
226 |
|
|
227 |
|
Now you can install any RPM source-package. |
228 |
|
It's components are installed into the corresponding |
229 |
|
subdirectories of your rpm-directory. |
230 |
|
Essentially these are the sources (into directory SOURCES) |
231 |
|
and the so-called spec-file which contains all build |
232 |
|
instructions. The spec-file will go into the SPEC directory. |
233 |
|
Example: |
234 |
|
<literal>rpm --install Thuban-0.9.0-1.src.rpm</literal> |
235 |
|
</para> |
236 |
|
|
237 |
|
<para> |
238 |
|
Create install-package: |
239 |
|
Go to the directory with the spec-files and rebuild the |
240 |
|
package: |
241 |
|
<programlisting> |
242 |
|
cd $HOME/mypm/SPECS |
243 |
|
rpm -bb thuban.spec |
244 |
|
</programlisting> |
245 |
|
Next, you will find the newly created package in |
246 |
|
$HOME/myrpm/RPMS/i386. |
247 |
|
If you build the package for another architecture than |
248 |
|
i386, then the name of the directory has a corresponding name. |
249 |
|
</para> |
250 |
|
<para> |
251 |
|
For documentation of RPM, either type |
252 |
|
<literal>man rpm</literal> or <literal>rpm --help</literal>. |
253 |
|
This will provide you with information on the various command |
254 |
|
line options of RPM. |
255 |
|
For more information see the |
256 |
|
<ulink url="http://www.rpm.org/">homepage of RPM</ulink>. |
257 |
|
</para> |
258 |
|
</section> |
259 |
|
</section> |
260 |
</section> |
</section> |
261 |
|
|
262 |
|
<section><title>Internationalization</title> |
263 |
|
<para> |
264 |
|
Thuban is implemented with internationalization support. So far Thuban |
265 |
|
is translated by volunteers to the following languages (apart from its |
266 |
|
main language: English): |
267 |
|
<itemizedlist> |
268 |
|
<listitem><para>French</para></listitem> |
269 |
|
<listitem><para>German</para></listitem> |
270 |
|
<listitem><para>Italian</para></listitem> |
271 |
|
<listitem><para>Russian</para></listitem> |
272 |
|
<listitem><para>Spanish</para></listitem> |
273 |
|
</itemizedlist> |
274 |
|
</para> |
275 |
|
|
276 |
|
<para> |
277 |
|
To use internationalization under POSIX systems (like GNU/Linux) |
278 |
|
you have to set the environment variable LC_ALL accordingly (e.g. |
279 |
|
LC_ALL=fr_FR for the french language support). Please check your |
280 |
|
systems documentation for details and supported settings. |
281 |
|
Specifiying LC_ALL on the command line while launching thuban |
282 |
|
allows appication specific language settings. |
283 |
|
</para> |
284 |
|
|
285 |
|
<para> |
286 |
|
MS Windows users have to specify the language to be used via the control |
287 |
|
bar (which effects all applications). |
288 |
|
</para> |
289 |
|
</section> |
290 |
|
|
291 |
<section><title>The Main Window</title> |
<section><title>The Main Window</title> |
292 |
<para> |
<para> |
293 |
<figure> |
<figure> |
438 |
|
|
439 |
<section><title>Adding and Removing Layers</title> |
<section><title>Adding and Removing Layers</title> |
440 |
<para> |
<para> |
441 |
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: |
442 |
|
Shape layers, database layers |
443 |
and image layers. Shape layers are stored in Shapefile format, a |
and image layers. Shape layers are stored in Shapefile format, a |
444 |
standard file format for storing geographic objects. These |
widely used file format for storing geographic objects. These |
445 |
files have the extension ``.shp''. Associated with |
files have the extension ``.shp''. Associated with |
446 |
the shape file is a database file which stores attributes for |
the shape file is a database file which stores attributes for |
447 |
each shape in the shape file. This file, in dBase format, |
each shape in the Shape file. This file, in dBase format, |
448 |
has the extension ``.dbf''. Both files must have the same base name. |
has the extension ``.dbf''. Both files must have the same base name. |
449 |
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 |
450 |
also be a file roads.dbf. |
also be a file roads.dbf. |
451 |
</para> |
</para> |
452 |
<para> |
<itemizedlist> |
453 |
|
<listitem> |
454 |
|
<para> |
455 |
Shape layers can be added to the map with |
Shape layers can be added to the map with |
456 |
<menuchoice> |
<menuchoice> |
457 |
<guimenu>Map</guimenu> |
<guimenu>Map</guimenu> |
458 |
<guimenuitem>Add Layer</guimenuitem> |
<guimenuitem>Add Layer</guimenuitem> |
459 |
</menuchoice>. |
</menuchoice>. |
460 |
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 |
461 |
matter if the shape file or database file is selected. |
selection. However, if you switch to display all files and select one |
462 |
|
of the associated files (e.g. ``.dbf''), Thuban will recognize the base |
463 |
|
name and load the corresponding Shape file. |
464 |
|
</para> |
465 |
|
<para> |
466 |
|
The file dialog for Shape files allows to select multiple files. |
467 |
|
Use the shift-button together with the left mouse button to extend |
468 |
|
the selection. |
469 |
</para> |
</para> |
470 |
|
</listitem> |
471 |
|
|
472 |
|
<listitem> |
473 |
|
<para>Database layers can be added to the map with |
474 |
|
<menuchoice> |
475 |
|
<guimenu>Map</guimenu> |
476 |
|
<guimenuitem>Add Database Layer</guimenuitem> |
477 |
|
</menuchoice>. |
478 |
|
A dialog with two is list is opened. The left list displays all |
479 |
|
database connections currently open for the session. You can retrieve |
480 |
|
a list of available layers from the selected database which is |
481 |
|
displayed on the right hand. From this list one layer can be selected, |
482 |
|
the dialog is closed afterwards. |
483 |
|
</para> |
484 |
|
<para> |
485 |
|
See appendix ``Working with PostGIS'' for details. |
486 |
|
</para> |
487 |
|
</listitem> |
488 |
|
|
489 |
|
<listitem> |
490 |
<para> |
<para> |
491 |
Image layers can be added to the map with |
Image layers can be added to the map with |
492 |
<menuchoice> |
<menuchoice> |
498 |
or in another file. If geographic information cannot be found, Thuban |
or in another file. If geographic information cannot be found, Thuban |
499 |
will report an error. |
will report an error. |
500 |
</para> |
</para> |
501 |
|
</listitem> |
502 |
|
</itemizedlist> |
503 |
</section> |
</section> |
504 |
|
|
505 |
<section><title>Navigation</title> |
<section><title>Navigation</title> |
791 |
</para> |
</para> |
792 |
</listitem> |
</listitem> |
793 |
</itemizedlist> |
</itemizedlist> |
794 |
|
|
795 |
|
<para> |
796 |
|
The most used layer related actions are also available from a |
797 |
|
popup menu. It is raised when a layer is clicked with the right mouse |
798 |
|
button. |
799 |
|
</para> |
800 |
|
|
801 |
|
<para> |
802 |
|
<figure> |
803 |
|
<title>Layer Popup Menu</title> |
804 |
|
<mediaobject> |
805 |
|
<imageobject><imagedata fileref="../images/3_5_popup_menu.png" format="PNG" scale="&imgscale;"/></imageobject> |
806 |
|
<imageobject><imagedata fileref="./images/3_5_popup_menu.eps" format="EPS" scale="&imgscale;"/></imageobject> |
807 |
|
</mediaobject> |
808 |
|
</figure> |
809 |
|
</para> |
810 |
|
|
811 |
<para> |
<para> |
812 |
Along the bottom of the legend is the scalebar. The scalebar |
Along the bottom of the legend is the scalebar. The scalebar |
813 |
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 |
852 |
|
|
853 |
<section><title>Types of Layers</title> |
<section><title>Types of Layers</title> |
854 |
<para> |
<para> |
855 |
There are two types of layers supported by Thuban: shape layers and |
There are three types of layers supported by Thuban: shape layers, |
856 |
|
database layers and |
857 |
image layers. Shape layers consist of vector based shapes with |
image layers. Shape layers consist of vector based shapes with |
858 |
geo-referenced coordinates. There are three types of supported |
geo-referenced coordinates. There are three types of supported |
859 |
shapes: polygons, lines (arc), and points. Image layers can be any image |
shapes: polygons, lines (arc), and points. Database layers are similar |
860 |
|
to shape layers but loaded from a database instead of the file system. |
861 |
|
Image layers can be any image |
862 |
file format supported by the Geo-spatial Data Abstraction Library |
file format supported by the Geo-spatial Data Abstraction Library |
863 |
(GDAL). The images must have geographic |
(GDAL). The images must have geographic |
864 |
coordinate data either embedded within the file or in a separate |
coordinate data either embedded within the file or in a separate |
1190 |
</figure> |
</figure> |
1191 |
</para> |
</para> |
1192 |
<para> |
<para> |
1193 |
Thuban is distributed with a sample collection of projections. The |
Thuban is distributed with a sample collection of projections and the |
1194 |
|
set of coordinate systems as used by the EPSG |
1195 |
|
(European Petroleum Survey Group). This quite large set is only displayed |
1196 |
|
if activated by the according checkbox. The set falls into two parts: |
1197 |
|
deprecated lists all projections which are no longer part of the |
1198 |
|
EPSG data base. |
1199 |
|
</para> |
1200 |
|
<para> |
1201 |
|
The |
1202 |
user can create new projections and make them available to all |
user can create new projections and make them available to all |
1203 |
future Thuban sessions. They may also be exported and imported so |
future Thuban sessions. They may also be exported and imported so |
1204 |
that custom projections can be distributed. |
that custom projections can be distributed. |
1478 |
</section> |
</section> |
1479 |
</chapter> |
</chapter> |
1480 |
|
|
1481 |
|
<chapter><title>Extensions</title> |
1482 |
|
<para> |
1483 |
|
Thuban is designed to be extensible. The term Extension is used as a |
1484 |
|
general term for anything that extends Thuban. |
1485 |
|
This chapter introduces into some oppportunities how to add and |
1486 |
|
handle extra functionality developed by your own or third parties. |
1487 |
|
</para> |
1488 |
|
|
1489 |
|
<section><title>Add personal extensions via thubanstart.py</title> |
1490 |
|
<para> |
1491 |
|
After Thuban has been started for the first time, a directory |
1492 |
|
.thuban is created within your home directory. |
1493 |
|
There you can add a file thubanstart.py which will be imported |
1494 |
|
by Thuban at start-up. It is recommended to add only import-statements |
1495 |
|
to this file to keep the actual code of extensions separate. |
1496 |
|
</para> |
1497 |
|
<para> |
1498 |
|
The modules to import must either be found through the environment |
1499 |
|
variable PYTHONPATH or directly be placed into the .thuban-directory. |
1500 |
|
</para> |
1501 |
|
<para> |
1502 |
|
As an example, copy the file examples/simple_extensions/hello_world.py |
1503 |
|
of the Thuban source code into the .thuban-directory of your home |
1504 |
|
directory. Now add add the statement import hello_world to the |
1505 |
|
file thubanstart.py and run Thuban. You will notice an additional |
1506 |
|
menu <menuchoice><guimenu>Extensions</guimenu></menuchoice> where |
1507 |
|
the new item for the Hello-World extension is placed - select it |
1508 |
|
to see the Hello-World message. |
1509 |
|
</para> |
1510 |
|
</section> |
1511 |
|
|
1512 |
|
<section><title>Extensions included in Thuban package</title> |
1513 |
|
<para> |
1514 |
|
The extensions described in this section are part of the |
1515 |
|
Thuban package, but not activated by default. |
1516 |
|
You will find them in the Thuban installation directory |
1517 |
|
under <literal>Extensions/</literal>. Activate them as personal |
1518 |
|
extensions via PYTHONPATH as described in the previous section. |
1519 |
|
Stable extensions will appear under the menu |
1520 |
|
<menuchoice><guimenu>Extensions</guimenu></menuchoice> and |
1521 |
|
extensions which are in experimental state and therefore |
1522 |
|
not fully functional under |
1523 |
|
<menuchoice><guimenu>Experimental</guimenu></menuchoice>. |
1524 |
|
</para> |
1525 |
|
|
1526 |
|
<section><title>Stable extensions</title> |
1527 |
|
<para> |
1528 |
|
These extensions provide extra-functionality to Thuban |
1529 |
|
that has not (yet) been integrated in the main application. |
1530 |
|
They are considered to be free of bugs, but may be |
1531 |
|
further polished with helpful user interactions. |
1532 |
|
</para> |
1533 |
|
<section><title>gns2shp</title> |
1534 |
|
<para> |
1535 |
|
This tool converts data of the Geospatial Names Server |
1536 |
|
(GNS, see <ulink url="http://www.nima.mil/gns"/>) |
1537 |
|
into Shapefile format. |
1538 |
|
The above web-site offer to download named places |
1539 |
|
information grouped by countries for all of the world |
1540 |
|
except USA for which other data are provided. |
1541 |
|
</para> |
1542 |
|
<para> |
1543 |
|
If you download and unpack a package, you will have |
1544 |
|
a text-file with suffix .txt. |
1545 |
|
Selecting such a file via gns2shp will create the |
1546 |
|
corresponding Shapefile with the same basename and |
1547 |
|
place it in the same direcory. Afterwards it |
1548 |
|
is automatically loaded into Thuban. |
1549 |
|
The Shapefile will not automatically be delete afterwards. |
1550 |
|
</para> |
1551 |
|
<para> |
1552 |
|
The gns2shp.py module can also be executed on the |
1553 |
|
command line for batch processing purposes. |
1554 |
|
</para> |
1555 |
|
<para> |
1556 |
|
A sample (<literal>ls.txt</literal> for Liechtenstein) |
1557 |
|
is included in the directory |
1558 |
|
<literal>Extensions/gns2shp/test</literal>. |
1559 |
|
</para> |
1560 |
|
</section> |
1561 |
|
</section> |
1562 |
|
<section><title>Experimental extensions</title> |
1563 |
|
<para> |
1564 |
|
All all of these functions have to be handled with care, |
1565 |
|
since they are neither complete nor well tested. |
1566 |
|
They are to be seen as a proof-of-concept and may |
1567 |
|
additionally in some cases of practical help. |
1568 |
|
</para> |
1569 |
|
<para> |
1570 |
|
Any interest on further improvement of these extensions |
1571 |
|
should be communicated towards the developer and user |
1572 |
|
community. |
1573 |
|
</para> |
1574 |
|
|
1575 |
|
<section><title>importAPR</title> |
1576 |
|
<para> |
1577 |
|
This command offer to load an ESRI� ArcView� project |
1578 |
|
file (suffix .apr) and convert it for use within Thuban. |
1579 |
|
After selecting a apr-file to load, a list |
1580 |
|
will be presented that offers to select one of the views |
1581 |
|
of the apr-file, provided there is more than one. |
1582 |
|
Furthermore, the Session Info-Tree is extended with |
1583 |
|
a complete representation of the parsed apr-file. |
1584 |
|
</para> |
1585 |
|
<para> |
1586 |
|
The legend of Thuban does not yet cover all of the elements as |
1587 |
|
supported by the legend of ArcView�. Therefore, the Thuban |
1588 |
|
map will look different. Furthermore, the apr-format is |
1589 |
|
a proprietary format, not openly documented. |
1590 |
|
Therefore, the interpretation is |
1591 |
|
partly based on reverse engeneering and good guessing. |
1592 |
|
</para> |
1593 |
|
<para> |
1594 |
|
The file-paths within the apr-file may not fit and potentially |
1595 |
|
are subject to fix in the apr-file. You can do this |
1596 |
|
applying any text editor. The paths are either absolute |
1597 |
|
or relative from where Thuban has been started. |
1598 |
|
</para> |
1599 |
|
<para> |
1600 |
|
A sample for the Iceland data is included as |
1601 |
|
<literal>Extensions/importAPR/samples/iceland.apr</literal>. |
1602 |
|
The file-paths are relative from the Thuban main directory. |
1603 |
|
</para> |
1604 |
|
</section> |
1605 |
|
</section> |
1606 |
|
</section> |
1607 |
|
|
1608 |
|
<section><title>Writing simple extensions</title> |
1609 |
|
<para> |
1610 |
|
Writing an extension for Thuban basically means to |
1611 |
|
implement the extra functionality in Python with all of the |
1612 |
|
Thuban classes, methods and variables available. |
1613 |
|
</para> |
1614 |
|
<para> |
1615 |
|
All classes and their methods are documented in the source code |
1616 |
|
(see their doc-strings). Here is an example from |
1617 |
|
Thuban/Model/layer.py that describes some of the methods |
1618 |
|
of a Layer object: |
1619 |
|
</para> |
1620 |
|
<programlisting> |
1621 |
|
<![CDATA[ |
1622 |
|
class BaseLayer(TitledObject, Modifiable): |
1623 |
|
|
1624 |
|
"""Base class for the layers.""" |
1625 |
|
|
1626 |
|
def __init__(self, title, visible = True, projection = None): |
1627 |
|
"""Initialize the layer. |
1628 |
|
|
1629 |
|
title -- the title |
1630 |
|
visible -- boolean. If true the layer is visible. |
1631 |
|
""" |
1632 |
|
TitledObject.__init__(self, title) |
1633 |
|
Modifiable.__init__(self) |
1634 |
|
self.visible = visible |
1635 |
|
self.projection = projection |
1636 |
|
|
1637 |
|
def Visible(self): |
1638 |
|
"""Return true if layer is visible""" |
1639 |
|
return self.visible |
1640 |
|
|
1641 |
|
def SetVisible(self, visible): |
1642 |
|
"""Set the layer's visibility.""" |
1643 |
|
self.visible = visible |
1644 |
|
self.issue(LAYER_VISIBILITY_CHANGED, self) |
1645 |
|
|
1646 |
|
def HasClassification(self): |
1647 |
|
"""Determine if this layer support classifications.""" |
1648 |
|
... |
1649 |
|
]]> |
1650 |
|
</programlisting> |
1651 |
|
<para> |
1652 |
|
This example intends to give you an impression of the |
1653 |
|
source-code-level documentation. |
1654 |
|
You have to make yourself familiar with |
1655 |
|
the Python programming language to understand some special |
1656 |
|
code elements. |
1657 |
|
</para> |
1658 |
|
<section><title>hello_world.py</title> |
1659 |
|
<para> |
1660 |
|
Traditionally, the first example should welcome the world. |
1661 |
|
Most of the code handles the frame for integrating a menu |
1662 |
|
item into Thuban while the actual raising of a message |
1663 |
|
is done in a single line. |
1664 |
|
</para> |
1665 |
|
<programlisting> |
1666 |
|
<![CDATA[ |
1667 |
|
# Copyright (C) 2003 by Intevation GmbH |
1668 |
|
# Authors: |
1669 |
|
# Jan-Oliver Wagner <[email protected]> |
1670 |
|
# |
1671 |
|
# This program is free software under the GPL (>=v2) |
1672 |
|
# Read the file COPYING coming with Thuban for details. |
1673 |
|
|
1674 |
|
""" |
1675 |
|
Extend Thuban with a sample Hello World to demonstrate simple |
1676 |
|
extensions. |
1677 |
|
""" |
1678 |
|
|
1679 |
|
__version__ = '$Revision$' |
1680 |
|
|
1681 |
|
# use _() already now for all strings that may later be translated |
1682 |
|
from Thuban import _ |
1683 |
|
|
1684 |
|
# Thuban has named commands which can be registered in the central |
1685 |
|
# instance registry. |
1686 |
|
from Thuban.UI.command import registry, Command |
1687 |
|
|
1688 |
|
# The instance of the main menu of the Thuban application |
1689 |
|
# See Thuban/UI/menu.py for the API of the Menu class |
1690 |
|
from Thuban.UI.mainwindow import main_menu |
1691 |
|
|
1692 |
|
def hello_world_dialog(context): |
1693 |
|
"""Just raise a simple dialog to greet the world. |
1694 |
|
|
1695 |
|
context -- The Thuban context. |
1696 |
|
""" |
1697 |
|
context.mainwindow.RunMessageBox(_('Hello World'), _('Hello World!')) |
1698 |
|
|
1699 |
|
|
1700 |
|
# create a new command and register it |
1701 |
|
registry.Add(Command('hello_world', _('Hello World'), hello_world_dialog, |
1702 |
|
helptext = _('Welcome everyone on this planet'))) |
1703 |
|
|
1704 |
|
# find the extensions menu (create it anew if not found) |
1705 |
|
extensions_menu = main_menu.find_menu('extensions') |
1706 |
|
if extensions_menu is None: |
1707 |
|
extensions_menu = main_menu.InsertMenu('extensions', _('E&xtensions')) |
1708 |
|
|
1709 |
|
# finally bind the new command with an entry in the extensions menu |
1710 |
|
extensions_menu.InsertItem('hello_world') |
1711 |
|
]]> |
1712 |
|
</programlisting> |
1713 |
|
</section> |
1714 |
|
<section><title>Registering a Command</title> |
1715 |
|
<para> |
1716 |
|
Mainly, our new function has to be registered to the Thuban |
1717 |
|
framework in order to connect it to the menu. A registered |
1718 |
|
command can also be connected to e.g. a toolbar button. |
1719 |
|
</para> |
1720 |
|
<para> |
1721 |
|
The instances and classes for this are imported at the beginning. |
1722 |
|
Any code not inside a method or class is directly executed when |
1723 |
|
the source-code module is imported. Therefore, the second |
1724 |
|
part of this example consist of the plain statements to create a new |
1725 |
|
Command and to add it to the menu. |
1726 |
|
</para> |
1727 |
|
<para> |
1728 |
|
By convention, it looks for a menu registered as ``extensions'' to |
1729 |
|
insert the new command. If it does not exist yet, it gets created. |
1730 |
|
It is advisable to copy this code for any of your extensions. |
1731 |
|
</para> |
1732 |
|
</section> |
1733 |
|
<section><title>The Thuban context</title> |
1734 |
|
<para> |
1735 |
|
A registered command that is called, always receives the |
1736 |
|
Thuban context. This instance provides our method with |
1737 |
|
hook references to all important components of the Thuban |
1738 |
|
application. |
1739 |
|
</para> |
1740 |
|
<para> |
1741 |
|
In the example hello_world.py, our function uses the |
1742 |
|
mainwindow component which offers a method to raise a |
1743 |
|
message dialog. In total there are three hooks: |
1744 |
|
<itemizedlist> |
1745 |
|
<listitem> |
1746 |
|
<para>application: |
1747 |
|
This object is the instance of the Thuban Application class. |
1748 |
|
Except maybe for loading or savinf sessions, you will not |
1749 |
|
need this object for a simple extension. |
1750 |
|
See Thuban/UI/application.py for the API. |
1751 |
|
</para> |
1752 |
|
</listitem> |
1753 |
|
<listitem> |
1754 |
|
<para>session: |
1755 |
|
The instance of the current session. It manages the sessions' |
1756 |
|
map and tables. You can set and remove the map or tables. |
1757 |
|
In may also get the map object. However, you should know that |
1758 |
|
internally it is already prepared to handle many maps. |
1759 |
|
Therfore, currently you would always receive a list with exactlty |
1760 |
|
one element. In the future, if there are more than one map, |
1761 |
|
you will not know which one is the currently display one and |
1762 |
|
therefore you should use the mainwindow as hook to find |
1763 |
|
the currently displayed map. |
1764 |
|
See Thuban/Model/session.py for the API. |
1765 |
|
</para> |
1766 |
|
</listitem> |
1767 |
|
<listitem> |
1768 |
|
<para> |
1769 |
|
mainwindow: The mainwindow object is central to manage various |
1770 |
|
GUI things such as the Legend sub-window. Most notably, |
1771 |
|
you get access to the canvas which is the window part where |
1772 |
|
the map is drawn. The canvas knows, which map it currently |
1773 |
|
draws and therefore you get the current map via |
1774 |
|
context.mainwindow.canvas.Map(). |
1775 |
|
See Thuban/UI/mainwindow.py for the API. |
1776 |
|
</para> |
1777 |
|
</listitem> |
1778 |
|
</itemizedlist> |
1779 |
|
</para> |
1780 |
|
</section> |
1781 |
|
</section> |
1782 |
|
</chapter> |
1783 |
|
|
1784 |
<chapter><title>Trouble Shooting</title> |
<chapter><title>Trouble Shooting</title> |
1785 |
<para> |
<para> |
1786 |
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. |
1876 |
</varlistentry> |
</varlistentry> |
1877 |
|
|
1878 |
<varlistentry> |
<varlistentry> |
1879 |
|
<term>PostGIS</term> |
1880 |
|
<listitem> |
1881 |
|
<para> |
1882 |
|
PostGIS adds support for geographic objects to the PostgreSQL |
1883 |
|
object-relational database. Different layer types (as for Shapefiles) |
1884 |
|
are supported. <ulink url="http://postgis.refractions.net">PostGIS |
1885 |
|
Homepage</ulink> |
1886 |
|
</para> |
1887 |
|
</listitem> |
1888 |
|
</varlistentry> |
1889 |
|
|
1890 |
|
<varlistentry> |
1891 |
<term>Raster files</term> |
<term>Raster files</term> |
1892 |
<listitem> |
<listitem> |
1893 |
<para> |
<para> |
1906 |
</variablelist> |
</variablelist> |
1907 |
</appendix> |
</appendix> |
1908 |
|
|
1909 |
|
<appendix><title>Working with PostGIS</title> |
1910 |
|
<para> |
1911 |
|
This section focusses on the use of PostGIS in the Thuban framework. For |
1912 |
|
installation and maintenance of spatial databases we refer to the |
1913 |
|
<ulink url="http://postgis.refractions.net">PostGIS Homepage</ulink>. |
1914 |
|
The Thuban PostGIS support requires the |
1915 |
|
<ulink url="http://initd.org/software/psycopg">psycopg module</ulink>. |
1916 |
|
</para> |
1917 |
|
|
1918 |
|
<para> |
1919 |
|
Working with PostGIS Databases is seperated into two steps: |
1920 |
|
<itemizedlist> |
1921 |
|
<listitem><para>Opening a Database Connection</para></listitem> |
1922 |
|
<listitem><para>Loading a Data Layer</para></listitem> |
1923 |
|
</itemizedlist> |
1924 |
|
</para> |
1925 |
|
<section><title>Opening a Database Connection</title> |
1926 |
|
<para> |
1927 |
|
Before a data layer can be loaded from a PostGIS database a |
1928 |
|
connection with the database has to be established. |
1929 |
|
<menuchoice> |
1930 |
|
<guimenu>Session</guimenu> |
1931 |
|
<guimenuitem>Database Connections ...</guimenuitem> |
1932 |
|
</menuchoice> opens a dialog for database connection |
1933 |
|
management. In the dialog new connections can be added |
1934 |
|
and existing ones can be removed. Removing a database |
1935 |
|
connection is not possible if the map still displays a |
1936 |
|
layer provided by this database connection. |
1937 |
|
</para> |
1938 |
|
<figure> |
1939 |
|
<title>Database Management Dialog</title> |
1940 |
|
<mediaobject> |
1941 |
|
<imageobject><imagedata fileref="./images/app_postgis_db_management.png" format="PNG" scale="&imgscale;"/></imageobject> |
1942 |
|
<imageobject><imagedata fileref="./images/app_postgis_db_management.eps" format="EPS" scale="&imgscale;"/></imageobject> |
1943 |
|
</mediaobject> |
1944 |
|
</figure> |
1945 |
|
|
1946 |
|
<para> |
1947 |
|
To add a new database connection to the session a dialog is |
1948 |
|
opened to specify the relevant connection data. Enter all |
1949 |
|
data relevant for your connection. If the connection fails |
1950 |
|
the dialog remains open and provides some hints on the failure. |
1951 |
|
</para> |
1952 |
|
<figure> |
1953 |
|
<title>Add Database Dialog</title> |
1954 |
|
<mediaobject> |
1955 |
|
<imageobject><imagedata fileref="./images/app_postgis_db_add.png" format="PNG" scale="&imgscale;"/></imageobject> |
1956 |
|
<imageobject><imagedata fileref="./images/app_postgis_db_add.eps" format="EPS" scale="&imgscale;"/></imageobject> |
1957 |
|
</mediaobject> |
1958 |
|
</figure> |
1959 |
|
|
1960 |
|
<para> |
1961 |
|
It is important to note that information on database connections are |
1962 |
|
also stored with the session. Passwords are NOT stored. If you load a |
1963 |
|
session with database connections you are asked to enter these |
1964 |
|
passwords again where required. |
1965 |
|
</para> |
1966 |
|
|
1967 |
|
</section> |
1968 |
|
|
1969 |
|
<section><title>Loading a Data Layer</title> |
1970 |
|
<para> |
1971 |
|
Data layers as part of a map are loaded with the |
1972 |
|
<menuchoice> |
1973 |
|
<guimenu>Map</guimenu> |
1974 |
|
<guimenuitem>Add Database Layer ...</guimenuitem> |
1975 |
|
</menuchoice> menu item. A dialog is raised displaying two choice |
1976 |
|
lists. In the left list all connected databases are shown. |
1977 |
|
Highlighting |
1978 |
|
one of these and issuing a retrieval results in a list of available |
1979 |
|
layer tables from that database. After selection of a |
1980 |
|
layer the dialog is closed. |
1981 |
|
</para> |
1982 |
|
<figure> |
1983 |
|
<title>Add Database Dialog</title> |
1984 |
|
<mediaobject> |
1985 |
|
<imageobject><imagedata fileref="./images/app_postgis_add_layer.png" format="PNG" scale="&imgscale;"/></imageobject> |
1986 |
|
<imageobject><imagedata fileref="./images/app_postgis_add_layer.eps" format="EPS" scale="&imgscale;"/></imageobject> |
1987 |
|
</mediaobject> |
1988 |
|
</figure> |
1989 |
|
|
1990 |
|
</section> |
1991 |
|
|
1992 |
|
</appendix> |
1993 |
|
|
1994 |
<appendix><title>Supported Projections</title> |
<appendix><title>Supported Projections</title> |
1995 |
<para> |
<para> |
1996 |
The following types of projections are directly support by |
The following types of projections are directly support by |