[OSM-dev] WMS with mapnik

Stephan Holl stephan.holl at intevation.de
Wed Jul 4 08:29:09 BST 2007


Dear list,

I have found a note bout not reinstall the WMS-server for OSM. I would
like to use it and therefor trying to set up a test-WMS-server with
ogcserver coming with mapnik.

I followed the advises closely on[1] but my services dies with the
following error (in apache-errorlog):
mod_fcgid: jonpy error: ArgumentError at Wed Jul  4 07:24:46 2007
mod_fcgid: ArgumentError: Python argument types in
mod_fcgid:     Layer.__init__(Layer)
mod_fcgid: did not match C++ signature:
mod_fcgid:     __init__(_object*, std::string)
mod_fcgid:     __init__(_object*, std::string, std::string)
mod_fcgid: /opt/mapnik/wms.py in __init__(self=<wms.WMSFactory instance
at 0x2b8690870c68>) 
mod_fcgid:    15 self.register_style('style1', sty) 
mod_fcgid:    16
mod_fcgid:    17                 lyr = Layer('world', '+init=epsg:4326')
mod_fcgid:    18                 lyr.datasource =
Shapefile(file='/opt/mapnik/data/world_boundaries/world_boundaries_m')
mod_fcgid:    19                 lyr.title = 'test' 
mod_fcgid:    20                 lyr.abstract = 'abstract' 
mod_fcgid:    21
mod_fcgid: lyr undefined, global Shapefile = <function Shapefile at
0x2b8689b70aa0>, file undefined
0x2b8689b70aa0>
mod_fcgid: /usr/lib/python2.4/site-packages/mapnik/ogcserver/cgiserver.py
0x2b8689b70aa0>in __init__(self=<__main__.WMSHandler object at
0x2b8689b70aa0>0x2b869086ce90>)
mod_fcgid:    44         except ImportError:
mod_fcgid:    45             raise ServerConfigurationError('The
factory module could not be loaded.') 
mod_fcgid:    46         if hasattr(mapfactorymodule, 'WMSFactory'): 
mod_fcgid:    47 self.mapfactory = getattr(mapfactorymodule,
'WMSFactory')() 
mod_fcgid:    48         else: 
mod_fcgid:    49             raise ServerConfigurationError('The
factory module does not have a WMSFactory class.') 
mod_fcgid:    50         if conf.has_option('server', 'debug'):
mod_fcgid: self = <__main__.WMSHandler object at
0x2b869086ce90>, self.mapfactory undefined, getattr undefined,
0x2b869086ce90>mapfactorymodule = <module 'wms' from
0x2b869086ce90>'/opt/mapnik/wms.pyc'>
0x2b869086ce90>
mod_fcgid: /usr/lib/python2.4/site-packages/jon/fcgi.py
0x2b869086ce90>in run(self=<jon.fcgi.Request object at 0x2b8690864a50>)
0x2b869086ce90>
mod_fcgid:   338       self._init()
mod_fcgid:   339       self.log(2, "Calling handler")
mod_fcgid:   340       try:
mod_fcgid:   341         handler = self._handler_type()
mod_fcgid:   342       except:
mod_fcgid:   343         self.traceback()
mod_fcgid:   344       else:
mod_fcgid: handler undefined, self = <jon.fcgi.Request object at
0x2b8690864a50>, self._handler_type = <class '__main__.WMSHandler'> ~

This is my wms.py-script (with only one layer for now):
from mapnik.ogcserver.WMS import BaseWMSFactory
from mapnik import *

class WMSFactory(BaseWMSFactory):

        def __init__(self):
                BaseWMSFactory.__init__(self)
                sty = Style()

                rl = Rule()
                rl.symbols.append(PolygonSymbolizer(Color(248,216,136)))
                rl.symbols.append(LineSymbolizer(Color(0,0,0),1))
                sty.rules.append( rl )

                self.register_style('style1', sty)

                lyr = Layer('world', '+init=epsg:4326')
                lyr.datasource =
Shapefile(file='/opt/mapnik/data/world_boundaries/world_boundaries_m')
lyr.title = 'test' lyr.abstract = 'abstract'

                self.register_layer(lyr, 'style1')
                self.finalize()

Perhaps someone could give me a hint how to solve this. I know that I
could use OpenLayers to serve the tiles with TileCache, but I like to
use desktop-WMS-clients with OSM-data

Thanks for any pointers

Best

	Stephan




More information about the dev mailing list