2009/6/20 Luca Delucchi <[email protected]>:
> Hi i'm trying to configure the wms server, i read the manual in the
> wiki, i did the map_factory [1], ocgserver.conf[2] e wms.py[3] but
> when i try python wms.py i have this error
>
> l...@lucacasa:~/prova_mapnik_tile/mapnik$ python wms.py
> Traceback (most recent call last):
>  File "wms.py", line 24, in <module>
>    from mapnik.ogcserver.cgiserver import Handler
>  File "/usr/lib/python2.5/site-packages/mapnik/ogcserver/cgiserver.py",
> line 29, in <module>
>    from wms111 import ExceptionHandler as ExceptionHandler111
>  File "/usr/lib/python2.5/site-packages/mapnik/ogcserver/wms111.py",
> line 22, in <module>
>    from common import ParameterDefinition, Response, Version, ListFactory, \
>  File "/usr/lib/python2.5/site-packages/mapnik/ogcserver/common.py",
> line 23, in <module>
>    from mapnik import Map, Color, Envelope, render, rawdata, Image,
> Projection as MapnikProjection, render_to_file, Coord
> ImportError: cannot import name rawdata
>
> what's wrong?

i solved this problem with the update to 0.6.0, thank's Dane, but now
i have another problem with loadXML

l...@lucacasa:~/Compilati/mapnik-0.6.0/utils/ogcserver$ python wms.py
<type 'exceptions.UserWarning'>
Python 2.5.2: /usr/bin/python
Sun Jun 21 00:14:38 2009

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /usr/lib/python2.5/site-packages/jon/cgi.py in
process(self=<jon.cgi.CGIRequest object at 0x917b42c>)
  507     self._init()
  508     try:
  509       handler = self._handler_type()
  510     except:
  511       self.traceback()
handler undefined
self = <jon.cgi.CGIRequest object at 0x917b42c>
self._handler_type = <class '__main__.OGCServerHandler'>

 /usr/lib/python2.5/site-packages/mapnik/ogcserver/cgiserver.py in
__init__(self=<__main__.OGCServerHandler object at 0x9194d4c>)
   51             raise ServerConfigurationError('The factory module
could not be loaded.')
   52         if hasattr(mapfactorymodule, 'WMSFactory'):
   53             self.mapfactory = getattr(mapfactorymodule,
'WMSFactory')()
   54         else:
   55             raise ServerConfigurationError('The factory module
does not have a WMSFactory class.')
self = <__main__.OGCServerHandler object at 0x9194d4c>
self.mapfactory undefined
builtingetattr = <built-in function getattr>
mapfactorymodule = <module 'map_factory' from
'/home/luca/Compilati/mapnik-0.6.0/utils/ogcserver/map_factory.pyc'>

 /home/luca/Compilati/mapnik-0.6.0/utils/ogcserver/map_factory.py in
__init__(self=<map_factory.WMSFactory instance at 0x919b10c>)
    3 class WMSFactory(BaseWMSFactory):
    4   def __init__(self):
    5     BaseWMSFactory.__init__(self)
    6     self.loadXML('home/luca/prova_mapnik_tile/mapnik/osm.xml')
    7     self.finalize()
self = <map_factory.WMSFactory instance at 0x919b10c>
self.loadXML = <bound method WMSFactory.loadXML of
<map_factory.WMSFactory instance at 0x919b10c>>

 /usr/lib/python2.5/site-packages/mapnik/ogcserver/WMS.py in
loadXML(self=<map_factory.WMSFactory instance at 0x919b10c>,
xmlfile='home/luca/prova_mapnik_tile/mapnik/osm.xml', strict=False)
   50     def loadXML(self, xmlfile, strict=False):
   51         tmp_map = Map(0,0)
   52         load_map (tmp_map, xmlfile, strict)
   53         for lyr in tmp_map.layers:
   54             style_count = len(lyr.styles)
global load_map = <Boost.Python.function object at 0x90c8248>
tmp_map = <mapnik._mapnik.Map object at 0x9193edc>
xmlfile = 'home/luca/prova_mapnik_tile/mapnik/osm.xml'
strict = False
<type 'exceptions.UserWarning'>: Could not load map file
'home/luca/prova_mapnik_tile/mapnik/osm.xml': File does not exist
    __class__ = <type 'exceptions.UserWarning'>
    __delattr__ = <method-wrapper '__delattr__' of
exceptions.UserWarning object at 0x919b0ec>
    __dict__ = {}
    __doc__ = 'Base class for warnings generated by user code.'
    __getattribute__ = <method-wrapper '__getattribute__' of
exceptions.UserWarning object at 0x919b0ec>
    __getitem__ = <method-wrapper '__getitem__' of
exceptions.UserWarning object at 0x919b0ec>
    __getslice__ = <method-wrapper '__getslice__' of
exceptions.UserWarning object at 0x919b0ec>
    __hash__ = <method-wrapper '__hash__' of exceptions.UserWarning
object at 0x919b0ec>
    __init__ = <method-wrapper '__init__' of exceptions.UserWarning
object at 0x919b0ec>
    __new__ = <built-in method __new__ of type object at 0x81464e0>
    __reduce__ = <built-in method __reduce__ of exceptions.UserWarning
object at 0x919b0ec>
    __reduce_ex__ = <built-in method __reduce_ex__ of
exceptions.UserWarning object at 0x919b0ec>
    __repr__ = <method-wrapper '__repr__' of exceptions.UserWarning
object at 0x919b0ec>
    __setattr__ = <method-wrapper '__setattr__' of
exceptions.UserWarning object at 0x919b0ec>
    __setstate__ = <built-in method __setstate__ of
exceptions.UserWarning object at 0x919b0ec>
    __str__ = <method-wrapper '__str__' of exceptions.UserWarning
object at 0x919b0ec>
    args = ("Could not load map file
'home/luca/prova_mapnik_tile/mapnik/osm.xml': File does not exist",)
    message = "Could not load map file
'home/luca/prova_mapnik_tile/mapnik/osm.xml': File does not exist"

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/jon/cgi.py", line 509, in process
    handler = self._handler_type()
  File "/usr/lib/python2.5/site-packages/mapnik/ogcserver/cgiserver.py",
line 53, in __init__
    self.mapfactory = getattr(mapfactorymodule, 'WMSFactory')()
  File "/home/luca/Compilati/mapnik-0.6.0/utils/ogcserver/map_factory.py",
line 6, in __init__
    self.loadXML('home/luca/prova_mapnik_tile/mapnik/osm.xml')
  File "/usr/lib/python2.5/site-packages/mapnik/ogcserver/WMS.py",
line 52, in loadXML
    load_map (tmp_map, xmlfile, strict)
UserWarning: Could not load map file
'home/luca/prova_mapnik_tile/mapnik/osm.xml': File does not exist


Content-Type: text/html; charset=iso-8859-1

<html><head><title>Error</title></head>
<body><h1>Error</h1>
<p>Sorry, an error occurred. Please try again later.</p>
</body></html>

>
> thanks
> Luca
>
> [1] from mapnik.ogcserver.WMS import BaseWMSFactory
>
> class WMSFactory(BaseWMSFactory):
>  def __init__(self):
>    BaseWMSFactory.__init__(self)
>    self.loadXMl('./mapfile.xml')
>    self.finalize()
>
>

I changed [1] with this

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

>
>
> [2] # $Id$
>
> # server: This section contains software related configuration parameters.
>
> [server]
>
> # module:  The module containing the MapFactory class.  See the readme for
> #          details.
>
> module= WMSFactory


and this with module=map_factory


>
> # service: This section contains service level metadata.
>
> [service]
>
> # title: The title of the server.
>
> title=Trentino OGC Server
>
> # abstract: An abstract describing the server.
>
> abstract=This abstract describes the server and its contents.
>
> # maxwidth, maxheight: The maximum size that a map will be supplied at.
> #                      Exceeding it will raise an error in the client.
>
> maxheight=1024
> maxwidth=1024
>
> # allowedepsgcodes:  The comma seperated list of epsg codes we want the server
> #                    to support and advertise as supported in GetCapabilities.
>
> allowedepsgcodes=900913,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/
>
> # fees: An explanation of the fee structure for the usage of your service,
> #       if any. Use the reserved keyword "none" if not applicable.
>
> fees=
>
> # keywords: A comma seperated list of key words.
>
> keywordlist=trantino, mapnik
>
> # accessconstraints: Plain language description of any constraints that might
> #                    apply to the usage of your service, such as hours of
> #                    operation.
>
> accessconstraints=italy
>
> # maxage:            The content of the HTTP Cache-Control header -
> #                    the maximum age of the content in a cache, measured
> #                    in seconds. One week is 604800 seconds, the default is
> #                    1 day.
>
> maxage=86400
>
> # contact: Contact information.  Provides information to service users on who
> #          to contact for help on or details about the service.
>
> [contact]
>
> contactperson=
> contactorganization=
> contactposition=
>
> addresstype=
> address=
> city=
> stateorprovince=
> postcode=
> country=
>
> contactvoicetelephone=
> contactelectronicmailaddress=
>
>
>
> [3] import sys
> from mapnik.ogcserver.cgiserver import Handler
> sys.path.append('/home/luca/prova_mapnik_tile/mapnik/map_factory.py')
> from jon import fcgi
>
> class OGCServerHandler(Handler):
>    configpath = '/home/luca/prova_mapnik_tile/mapnik/ogcserver.conf'
>
> fcgi.Server({fcgi.FCGI_RESPONDER: OGCServerHandler}).run()
>

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

Reply via email to