1 | .. _environment: |
---|
2 | |
---|
3 | Using ZOO from an OSGeoLive virtual machine |
---|
4 | =========================================== |
---|
5 | |
---|
6 | Development Environment Description |
---|
7 | ----------------------------------- |
---|
8 | |
---|
9 | `OSGeoLive <http://live.osgeo.org/>`__ is a live DVD and virtual machine based on |
---|
10 | `Xubuntu <http://www.xubuntu.org/>`__ that allows you to try a |
---|
11 | wide variety of open source geospatial software without installing anything. It is |
---|
12 | composed entirely of free software and include ZOO 1.0 this year, for testing purpose. |
---|
13 | |
---|
14 | As already said in introduction, an OSGeoLive virtual machine image disk has been |
---|
15 | installed on your computer, allowing you to use ZOO Kernel in a development environment |
---|
16 | directly. Using a virtual machine image disk seems to be the simplest way to use |
---|
17 | ZOO Kernel and to develop ZOO Services locally, as we can ensure that everything |
---|
18 | requested for compile C Services and run Python Services is available and ready to use. |
---|
19 | Every ZOO related material and source code have been placed in */home/user/zoows* directory. |
---|
20 | We will work inside it during this workshop. As the binary version of ZOO Kernel is |
---|
21 | already compiled and stored in */home/user/zoows/sources/zoo-kernel*, you only have to |
---|
22 | copy two important files inside the */usr/lib/cgi-bin directory*: *zoo_loader.cgi* |
---|
23 | and the *main.cfg* in order to make ZOO Kernel available, using the following commands: |
---|
24 | |
---|
25 | :: |
---|
26 | |
---|
27 | sudo cp ~/zoows/sources/zoo-kernel/zoo_loader.cgi /usr/lib/cgi-bin |
---|
28 | sudo cp ~/zoows/sources/zoo-kernel/main.cfg /usr/lib/cgi-bin |
---|
29 | |
---|
30 | Please note that we will talk about ZOO Kernel or zoo_loader.cgi script without any |
---|
31 | distinction during this workshop. |
---|
32 | |
---|
33 | The *main.cfg* file contains metadata informations about the identification and provider |
---|
34 | but also some important settings. The file is composed of various sections, namely *main*, |
---|
35 | *identification* and *provider* per default. Obviously, you are free to add new sections |
---|
36 | to the files if you need them for a specific Service. Nevertheless, you have to know |
---|
37 | that the env section name is used in a specific way. It lets you define environment |
---|
38 | variables that your Service requires during its runtime. For instance, if your Service |
---|
39 | requires to access to a X server running on framebuffer, you can add *DISPLAY=:1* line in |
---|
40 | your env section to take this specificity into account. |
---|
41 | |
---|
42 | Please have a look to this file. Three important parameters are commented below: |
---|
43 | |
---|
44 | serverAddress |
---|
45 | The url to access to the ZOO Kernel |
---|
46 | |
---|
47 | tmpPath |
---|
48 | The full path to store temporary files |
---|
49 | |
---|
50 | tmpUrl |
---|
51 | The url path relative to serverAddress to access temporary directory. |
---|
52 | |
---|
53 | The values of the *main.cfg* file used from the running virtual machine are the following: |
---|
54 | |
---|
55 | :: |
---|
56 | |
---|
57 | serverAddress=http://localhost/zoo |
---|
58 | tmpPath=/var/www/temp |
---|
59 | tmpUrl=../temp/ |
---|
60 | |
---|
61 | You could have noticed that the *tmpUrl* is a relative url from *serverAddress*, so it must |
---|
62 | be a directory. Even if ZOO Kernel can be used with the full url of the zoo_loader.cgi |
---|
63 | script, for better readability and fully functional ZOO Kernel, you have to modify the |
---|
64 | default Apache configuration in order to be able to use the http://localhost/zoo/ url |
---|
65 | directly. |
---|
66 | |
---|
67 | First, please create a zoo directory in the existing */var/www* which is used by Apache as |
---|
68 | the DirectoryIndex. Then, please edit the */etc/apache2/sites-available/default* configuration |
---|
69 | file and add the following lines after the Directory block related to */var/www* directory : |
---|
70 | |
---|
71 | :: |
---|
72 | |
---|
73 | <Directory /var/www/zoo/> |
---|
74 | Options Indexes FollowSymLinks MultiViews |
---|
75 | AllowOverride All |
---|
76 | Order allow,deny |
---|
77 | allow from all |
---|
78 | </Directory> |
---|
79 | |
---|
80 | Now create a small *.htaccess* file in the */var/www/zoo* containing the following lines: |
---|
81 | |
---|
82 | :: |
---|
83 | |
---|
84 | RewriteEngine on |
---|
85 | RewriteRule (.*)/(.*) /cgi-bin/zoo_loader.cgi?metapath=$1 [L,QSA] |
---|
86 | RewriteRule (.*) /cgi-bin/zoo_loader.cgi [L,QSA] |
---|
87 | |
---|
88 | For this last file to be taken into account by Apache, you must activate the rewrite |
---|
89 | Apache module by copying a load file as bellow : |
---|
90 | |
---|
91 | :: |
---|
92 | |
---|
93 | sudo cp /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/ |
---|
94 | |
---|
95 | Now you should be able to access the ZOO Kernel using a simplified by restarting |
---|
96 | your Apache Web server : |
---|
97 | |
---|
98 | :: |
---|
99 | |
---|
100 | sudo /etc/init.d/apache2 restart |
---|
101 | |
---|
102 | Two other softwares form the OSGeoLive environment will be used during this workshop. |
---|
103 | Geoserver will first be used to provide WFS input data for the ZOO Services we are going |
---|
104 | to develop. The Geoserver sample dataset (United States polygons) will be passed to our |
---|
105 | service during section 3. So please start the Geoserver using the corresponding launcher |
---|
106 | in the Servers folder, as illustrated in the following screenshot : |
---|
107 | |
---|
108 | OpenLayers library is also available on the OSGeoLive virtual machine image disk, and it |
---|
109 | will be used during section 4, for building a simple WPS client application able to query |
---|
110 | the newly developed ZOO Services. |
---|
111 | |
---|
112 | As we planned to use OGR C-API and Python module of the GDAL library, we will need the |
---|
113 | corresponding header files, libraries and associated files. Hopefully everything was |
---|
114 | already available per default and so ready to use on the OSGeoLive packaging. |
---|
115 | |
---|