root/trunk/docs/ogcserver/readme.txt

Revision 435, 4.6 kB (checked in by jdoyon, 19 months ago)

- Edit ogcserver docs to mention GetFeatureInfo? support.

  • Property svn:keywords set to Id
Line 
1# $Id$
2
3Mapnik OGC Server
4-----------------
5
6
7Introduction
8------------
9
10        Mapnik provides a server package to allow the publishing of maps
11through the open and standard WMS interface published by the Open Geospatial
12Consortium (OGC).  It is in implemented in Python, around the core C++
13library.
14
15
16Features/Caveats
17----------------
18
19- WMS 1.1.1 and 1.3.0
20- CGI/FastCGI
21- Supports all 3 requests: GetCapabilities, GetMap and GetFeatureInfo
22- GetFeatureInfo supports text/plain output only
23- JPEG/PNG output
24- XML/INIMAGE/BLANK error handling
25- Multiple named styles support
26- Reprojection support
27- Supported layer metadata: title, abstract
28- Needs to be able to write to tempfile.gettempdir() (most likely "/tmp")
29
30
31Dependencies
32------------
33
34Please properly install the following before proceeding further:
35
36- jonpy (http://jonpy.sourceforge.net/)
37- lxml (http://codespeak.net/lxml/)
38- PIL (http://www.pythonware.com/products/pil)
39- PROJ.4 (http://proj.maptools.org/)
40
41
42Installation
43------------
44
45- Make sure Mapnik was compiled and linked with PROJ.4 support.  If this isn't
46  the case, recompile Mapnik and make sure it is.
47
48- The executable "ogcserver" in utils/ogcserver will work for both CGI and
49  FastCGI operations.  Where to place it will depend on your server's
50  configuration and is beyond this documentation.  For information on FastCGI
51  go to http://www.fastcgi.com/.
52
53
54Configuring the server
55----------------------
56
57- You will need to edit the ogcserver executable for now.  It is a simple
58  Python text script.
59 
60  1) Edit the path to the interpreter in the first line.
61  2) Edit the path to the config file if you don't like the default.
62 
63- Copy the sample configuration "ogcserver.conf" file in utils/ogcserver to
64  the location you specified in the previous step.
65 
66- Edit the configuration file to your liking, the comments within the file will
67  help you further.  Be sure to at the very minimum edit the "module"
68  parameter, the server will not work without you setting it properly first.
69 
70
71Defining layers and styles for use by the ogcserver
72---------------------------------------------------
73
74        The ogcserver obviously needs layers to publish.  For now, with Mapnik, this
75can only be done by writing code. In this case, a Python script will need to be
76written to describe the layers and respective styles.  For information on the Python
77API, look in demo/python, or in docs/epydocs.
78
79The server needs a python module, with code that looks like this:
80
81from mapnik.ogcserver.WMS import BaseWMSFactory
82from mapnik import Layer, Style
83
84class WMSFactory(BaseWMSFactory):
85
86        def __init__(self):
87                BaseWMSFactory.__init__(self)
88                sty = Style()
89                ...
90                self.register_style('stylename', sty)
91               
92                lyr = Layer('layername', '+init=epsg:4326')
93                lyr.title = 'Layer title'
94                lyr.abstract = 'Layer abstract'
95                ...
96                self.register_layer(lyr, 'stylename')
97                self.finalize()
98               
99The rules for writing this class are:
100
101- It MUST be called 'WMSFactory'.
102- It MUST sub-class mapnik.ogcserver.WMS.BaseWMSFactory.
103- The __init__ MUST call the base class'.
104- Layers MUST be named with the first parameter to the constructor.
105- Layers MUST define an EPSG projection in the second parameter to the
106  constructor.  This implies that the underlying data must be in an EPSG
107  projection already.
108- style and layer names are meant for machine readability, not human.  Keep
109  them short and simple, without spaces or special characters.
110- For human readable info, set the title and abstract properties on the layer
111  object.
112- DO NOT register styles using layer.styles.append(), instead, provide style
113  information to the register_layer() call:
114 
115  register_layer(layerobject, defaultstylename, tuple of alternative style names)
116
117- No Map() object is used or needed here.
118- Be sure to call self.finalize() once you've registered everything! This will
119  validate everything and let you know if there's problems.
120- For a layer to be queryable via GetFeatureInfo, simply set the 'queryable'
121  property to True:
122 
123  lyr.queryable = True
124
125
126To Do
127-----
128
129- Investigate moving to cElementTree from lxml.
130- Add some internal "caching" for performance improvements.
131- Switch to using C/C++ libs for image generation, instead of PIL (also
132  requires core changes). PIL requirement will remain for INIMAGE/BLANK
133  error handling.
134- Implement other connectors than CGI/FastCGI (Such as WSGI, SCGI, etc ...)
135
136
137Conclusion
138----------
139
140        This is the very first implementation of a WMS for Mapnik.  Although inital
141testing seems to suggest it works well, there may be bugs, and it lacks some
142useful features.  Comments, contributions, and requests for help should all be
143directed to the Mapnik mailing list.
144
145Enjoy!
146J.F.
Note: See TracBrowser for help on using the browser.