Hello!

I tried to set up a Mapnik WMS with Apache2 and PostGIS database/datasource. I followed this tutorial: http://www.perrygeo.net/wordpress/?p=49, but when I ran the script in the browser, the output was the content of my script. My os is Debian Lenny, the version of Apache 2.2.9-10. This is my query string in the browser: http://localhost/fcgi-bin/wms?VERSION=1.1.1&REQUEST=GetMap&LAYERS=hungary.roads&FORMAT=image/png&SRS=EPSG:4326&STYLES=&BBOX=16.0,45.5,23.0,48.7&EXCEPTIONS=application/vnd.ogc.se_inimage&width=600&height=300
Here is my map_factory.py:

from mapnik.ogcserver.WMS import BaseWMSFactory

class WMSFactory(BaseWMSFactory):
    def __init__(self):
    BaseWMSFactory.__init__(self)
           self.loadXML('/opt/mapnik/mapfile.xml')
           self.finalize()

the mapfile.xml:

<Map bgcolor="#f2eff9" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over">
<Style name="HungaryStyle">
<Rule>
<LineSymbolizer>
<CssParameter name="stroke">#000080</CssParameter>
<CssParameter name="stroke-width">0.2</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Layer name="hungary.roads" srs="+proj=latlong +datum=WGS84">
<StyleName>HungaryStyle</StyleName>
<Datasource>
<Parameter name="type">postgis</Parameter>
<Parameter name="host">localhost</Parameter>
<Parameter name="dbname">hungary</Parameter>
<Parameter name="user">mapuser</Parameter>
<Parameter name="password">mapuser</Parameter>
<Parameter name="table">hungary.roads</Parameter>
</Datasource>
</Layer>
</Map>

the ogcserver.conf:

# server: This section contains software related configuration parameters.
[server]
# module:  The module containing the MapFactory class.  See the readme for
#          details.
# This would be the name of the map_factory file (without extension .py)
module=/opt/mapnik/map_factory
# service: This section contains service level metadata.
[service]
# maxwidth, maxheight: The maximum size that a map will be supplied at.
#                      Exceeding it will raise an error in the client.
maxheight=2048
maxwidth=2048
# allowedepsgcodes: The comma seperated list of epsg codes we want the server # to support and advertise as supported in GetCapabilities.
allowedepsgcodes=4326
# onlineresource: A service level URL most likely pointing to the web site supporting the service for example. This is NOT the online resource pointing to the CGI.
onlineresource=http://localhost/

and my wms.py script:

#!/usr/bin/env python
# Your mapnik dir containing the map factory
# must be in the python path!

import sys
sys.path.append('/opt/mapnik/')

from mapnik.ogcserver.cgiserver import Handler
import jon.fcgi as fcgi

class WMSHandler(Handler):
    configpath = '/opt/mapnik/ogcserver.conf'
fcgi.Server({fcgi.FCGI_RESPONDER: WMSHandler}).run()

If anyone know what I am doing wrong, please write to me!
Thanks, Tamas J

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to