Changeset 757 for trunk/docs
- Timestamp:
- 11/14/08 20:24:19 (8 weeks ago)
- Files:
-
- 1 modified
-
trunk/docs/ogcserver/readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/ogcserver/readme.txt
r435 r757 8 8 ------------ 9 9 10 Mapnik provides a server package to allow the publishing of maps10 Mapnik provides a server package to allow the publishing of maps 11 11 through the open and standard WMS interface published by the Open Geospatial 12 12 Consortium (OGC). It is in implemented in Python, around the core C++ … … 72 72 --------------------------------------------------- 73 73 74 The ogcserver obviously needs layers to publish. For now, with Mapnik, this74 The ogcserver obviously needs layers to publish. For now, with Mapnik, this 75 75 can only be done by writing code. In this case, a Python script will need to be 76 76 written to describe the layers and respective styles. For information on the Python 77 77 API, look in demo/python, or in docs/epydocs. 78 78 79 The server needs a python module, with code that looks like this: 79 The server needs a python module, with code that looks like this:: 80 80 81 from mapnik.ogcserver.WMS import BaseWMSFactory82 from mapnik import Layer, Style83 84 class 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()81 from mapnik.ogcserver.WMS import BaseWMSFactory 82 from mapnik import Layer, Style 83 84 class 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 98 99 99 The rules for writing this class are: … … 111 111 object. 112 112 - DO NOT register styles using layer.styles.append(), instead, provide style 113 information to the register_layer() call: 113 information to the register_layer() call:: 114 114 115 register_layer(layerobject, defaultstylename, tuple of alternative style names)115 register_layer(layerobject, defaultstylename, tuple of alternative style names) 116 116 117 117 - No Map() object is used or needed here. … … 119 119 validate everything and let you know if there's problems. 120 120 - For a layer to be queryable via GetFeatureInfo, simply set the 'queryable' 121 property to True: 121 property to True:: 122 122 123 lyr.queryable = True123 lyr.queryable = True 124 124 125 125 … … 138 138 ---------- 139 139 140 This is the very first implementation of a WMS for Mapnik. Although inital140 This is the very first implementation of a WMS for Mapnik. Although inital 141 141 testing seems to suggest it works well, there may be bugs, and it lacks some 142 142 useful features. Comments, contributions, and requests for help should all be
