Show
Ignore:
Timestamp:
11/14/08 20:24:19 (8 weeks ago)
Author:
dane
Message:

Minor edits to ogcserver readme for reST format

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/docs/ogcserver/readme.txt

    r435 r757  
    88------------ 
    99 
    10         Mapnik provides a server package to allow the publishing of maps 
     10Mapnik provides a server package to allow the publishing of maps 
    1111through the open and standard WMS interface published by the Open Geospatial 
    1212Consortium (OGC).  It is in implemented in Python, around the core C++ 
     
    7272--------------------------------------------------- 
    7373 
    74         The ogcserver obviously needs layers to publish.  For now, with Mapnik, this 
     74The ogcserver obviously needs layers to publish.  For now, with Mapnik, this 
    7575can only be done by writing code. In this case, a Python script will need to be 
    7676written to describe the layers and respective styles.  For information on the Python 
    7777API, look in demo/python, or in docs/epydocs. 
    7878 
    79 The server needs a python module, with code that looks like this: 
     79The server needs a python module, with code that looks like this:: 
    8080 
    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() 
     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() 
    9898                 
    9999The rules for writing this class are: 
     
    111111  object. 
    112112- 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:: 
    114114   
    115   register_layer(layerobject, defaultstylename, tuple of alternative style names) 
     115    register_layer(layerobject, defaultstylename, tuple of alternative style names) 
    116116 
    117117- No Map() object is used or needed here. 
     
    119119  validate everything and let you know if there's problems. 
    120120- For a layer to be queryable via GetFeatureInfo, simply set the 'queryable' 
    121   property to True: 
     121  property to True:: 
    122122   
    123   lyr.queryable = True 
     123    lyr.queryable = True 
    124124 
    125125 
     
    138138---------- 
    139139 
    140         This is the very first implementation of a WMS for Mapnik.  Although inital 
     140This is the very first implementation of a WMS for Mapnik.  Although inital 
    141141testing seems to suggest it works well, there may be bugs, and it lacks some 
    142142useful features.  Comments, contributions, and requests for help should all be