source: trunk/workshop/2014/building_blocks_presentation.rst @ 785

Last change on this file since 785 was 725, checked in by djay, 9 years ago

Fix issue with rst files displayed from Trac. Fix strings to be translated. Always use the same string in all messages.

  • Property svn:keywords set to Date Author
  • Property svn:mime-type set to text/plain
File size: 6.0 KB
Line 
1.. _ogr_base_vect_ops:
2
3Building blocks presentation - Using OGR and PgRouting based Web Services
4=====================================================
5
6.. contents:: Table of Contents
7    :depth: 5
8    :backlinks: top
9
10Introduction
11---------------------------------------------------
12
13In this section, you will use basic ZOO-Services : ``Buffer``,
14``Intersection`` and ``DifferencePy`` which use OGR and psycopg Python modules.
15The intended goal of this section is to present and interact with your new building blocks before chaining them in the next section.
16
17First of all, you should use the following links to access the user
18interfaces and interact with your services, the first one is used to
19access basic spatial-tools demo client interface and  the second to
20access the routing application :
21  * `http://localhost/zoo-ws/spatialtools-py.html <http://localhost/zoo-ws/spatialtools-py.html>`__
22  * `http://localhost/zoo-ws/ <http://localhost/zoo-ws/>`__
23
24Services Provider and configuration files
25---------------------------------------------------
26
27First you may verify if the ZOO-Services are available from your current setup.
28You can take a look at the ``Buffer.zcfg``, ``Intersection.zcfg`` and
29``DifferencePy.zcfg`` to get details about parameters.
30As you can see from the ZCFG files, you will use ZOO-Services provided by the
31``service`` Python service provider. So if you want to modify the Python code
32you will have to edit the corresponding file (so ``service.py``).
33You are invited to use similar requests as the one used in previous
34sections to learn about each services individually.
35
36The Buffer Service
37---------------------------------------------------
38
39First click on a street then once the street is displayed in blue, click the
40'Buffer' button on top, you should get similar result as displayed in the following.
41
42.. image:: ./images/Buffer_Level_15.png
43   :width: 650px
44   :align: center
45
46Since version ZOO-Project 1.2.0, you can run automatically some basic tests to
47make sure that you wrote a correct ZCFG file and your service is validating.
48
49.. note:: the current testing is really simple and should be adapted to each Services
50    Provider, mainly to define input names.
51
52You can use the following command:
53
54.. code-block:: bash
55   
56    cd /home/user/zoo/testing
57    ./run.sh http://localhost/cgi-bin/zoo_loader.cgi Buffer
58
59
60.. note:: During or after the test run, you can take a look inside the ``tmp`` directory
61    which contains both the XML requests send to the ZOO Kernel (``*1.xml``) and the
62    responses it gave (``output*.xml``).
63
64The Intersection Service
65---------------------------------------------------
66
67Using the same client interface as before, once you get a Buffer, you can then
68select a street intersecting the Buffer geometry to compute intersection by clicking on the Intersection button.
69
70   
71.. image:: ./images/Intersection_Level_15.png
72   :width: 650px
73   :align: center
74
75
76The DifferencePy Service
77---------------------------------------------------
78
79Using the same instructions as for Intersetion, you can get the following result.
80
81.. image:: ./images/Difference_Level_15.png
82   :width: 650px
83   :align: center
84
85
86The Routing and Profile Services
87---------------------------------------------------
88
89First click on the blue flag then place your starting point on the
90map, do the same with the red flag to get the shortest path computed
91by the dedicated service and then display its profile. Note that when
92you pass the mouse over the profile display then you will see its
93corresponding position displayed on the map. You can also click on a
94specific step in your path to get the corresponding line displayed.
95
96.. image:: ./images/Routing_Basic.png
97   :width: 650px
98   :align: center
99
100If you take a look in the file: ``/usr/lib/cgi-bin/routing/do.zcfg``
101you may notice something new in the supported format which is
102reproduced here after.
103 
104.. code-block:: guess
105   
106    <Supported>
107     mimeType = image/png
108     asReference = true
109     msStyle = STYLE COLOR 125 0 105 OUTLINECOLOR 0 0 0 WIDTH 3 END
110     useMapServer = true
111     extension = json
112    </Supported>
113
114The ``mimeType`` is defined as ``image/png`` and there is two new
115parameter which are both optional:
116  * ``useMapServer``: which make you able to inform the ZOO-Kernel
117    that it have to use MapServer to publish your result as WMS / WFS or WCS (this last
118    won't be used in this workshop) rather than simply storing the
119    result as a file.
120  * ``msStyle``: which let you define your own MapServer ``STYLE`` block definition.
121
122When you need to access a result many time or for different purpose
123accross other services then it is really useful to ask ZOO-Kernel to
124publish your result as WMS, WFS or WCS.
125
126Note that no modification of the code of the do service was required
127to handle automatic pubilcation of the result as it is a vector format
128supported by OGR, only modification of the zcfg was required.
129
130This routing example is here to illustrate how easy it is to publish
131your result as WMS, WFS or WCS ressource. Indeed, when your routing
132service was called, ZOO-Kernel published the result as WMS and WFS
133ressources which was both used first for the UI purpose, the WMS to
134display the resulting path on the map, the WFS for displaying details
135about each steps. The WFS protocol is also used as the input value
136for the profile computation. So, the computation was run once
137and accessed three times for different purposes and from different
138clients.
139
140For more informations about the MapServer support, please refer to `the
141official  ZOO-Project Documentation <http://zoo-project.org/docs/kernel/mapserver.html>`_.
142
143Conclusion
144---------------------------------------------------
145
146Now you know this three services, and you get a simple interface to interact
147with your MapServer WFS and your ZOO-Project WPS Servers, you are ready to use
148the Services in a different way, by chaining them using the JavaScript ZOO-API to build
149more complexe and powerfull services.
Note: See TracBrowser for help on using the repository browser.

Search

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png