[Mapnik-users] How to use OGC Server (mapnik 0_7_0)
Ozodbek Ulmasov
ozodbekulmasov at gmail.com
Tue Jan 26 09:03:22 CET 2010
I've corrected population.xml file.
After launching wms.py, I got the message " listening on port 8000... "
After opening this link in browser i got the followings:
---
Welcome to the Mapnik OGCServer.
Ready to accept map requests...
For more info see: trac.mapnik.org
---
How I can open the map in my browser with openlayers?
To test the WMS I tried to open the following link
http://localhost:8000/wms/wms.py?LAYERS=world&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=-180.0000000000001,-90,119.46385052802589,209.463850528026&WIDTH=256&HEIGHT=256
but the following error occurs:
----
OGCServer Error:
Traceback (most recent call last):
File "c:\mapnik_0_7_0\python\2.5\site-packages\mapnik\ogcserver\wsgi.py",
line 89, in __call__
response = requesthandler(ogcparams)
File
"c:\mapnik_0_7_0\python\2.5\site-packages\mapnik\ogcserver\wms111.py", line
212, in GetMap
return WMSBaseServiceHandler.GetMap(self, params)
File
"c:\mapnik_0_7_0\python\2.5\site-packages\mapnik\ogcserver\common.py", line
315, in GetMap
m = self._buildMap(params)
File
"c:\mapnik_0_7_0\python\2.5\site-packages\mapnik\ogcserver\common.py", line
392, in _buildMap
raise OGCException('Layer "%s" not defined.' % layername,
'LayerNotDefined')
OGCException: ('Layer "world" not defined.', 'LayerNotDefined')
Traceback:
LayerNotDefined
----
On Mon, Jan 25, 2010 at 7:31 PM, <gilles.bassiere at makina-corpus.com> wrote:
> Hello,
>
> The traceback seems to point an error in your XML configuration file. It
> says it is not able to find the datasource of the "countries" layer.
> Have you double-checked that pathes are all correct? Have you tried with
> and without filename extension?
> In order to make sure your XML file is correct, you can test it using
> nik2img or the Mapnik Python bindings.
>
> Regards
> Gilles
>
> Ozodbek Ulmasov <ozodbekulmasov at gmail.com> a écrit :
>
>
> On launching wms.py the following error appears:
>>
>> Traceback (most recent call last):
>> File "c:\ms4w\Apache\htdocs\wms\wms.py", line 21, in <module>
>> application = WSGIApp('C:/ms4w/Apache/htdocs/wms/ogcserver.conf')
>> File "C:\mapnik_0_7_0\python\2.5\site-packages\mapnik\ogcserver\wsgi.py",
>> line
>> 44, in __init__
>> self.mapfactory = getattr(mapfactorymodule, 'WMSFactory')()
>> File "C:\ms4w\Apache\htdocs\wms\xml_factory.py", line 7, in __init__
>> self.loadXML('C:/ms4w/Apache/htdocs/wms/population.xml')
>> File "C:\mapnik_0_7_0\python\2.5\site-packages\mapnik\ogcserver\WMS.py",
>> line
>> 52, in loadXML
>> load_map (tmp_map, xmlfile, strict)
>> RuntimeError: C:/ms4w/Apache/htdocs/mapnik/wms/data/thematic_mapping_world
>> does
>> not exist (encountered during parsing of layer 'countries')
>>
>> I have installed OGC Server as written in the following documentation:
>> http://trac.mapnik.org/wiki/OgcServer
>>
>> The following files were configured:
>>
>> ######### wms.py ############
>> import sys
>> from mapnik.ogcserver.wsgi import WSGIApp
>> sys.path.append('c:/ms4w/Apache/htdocs/wms/')
>>
>> application = WSGIApp('c:/ms4w/Apache/htdocs/wms/ogcserver.conf')
>>
>>
>> if __name__ == '__main__':
>> from wsgiref.simple_server import make_server
>> httpd = make_server('localhost', 8000, application)
>> print "Listening on port 8000...."
>> httpd.serve_forever()
>>
>> ####### ogcserver.conf #########
>> [server]
>> module= xml_factory
>> debug=1
>>
>> [service]
>> title=MapnikOGC
>> abstract=The Mapnik OGC Server Sample Configuration
>> maxheight=2048
>> maxwidth=2048
>> # 3031 is an antarctica polar projection
>> allowedepsgcodes=3031,4326,3395,900913
>>
>> #onlineresource=http://localhost:8888/
>> fees=
>> keywordlist=mapnik
>> accessconstraints=
>>
>> [contact]
>> contactperson=
>> contactorganization=
>> contactposition=
>> addresstype=
>> address=
>> city=
>> stateorprovince=
>> postcode=
>> country=
>> contactvoicetelephone=
>> contactelectronicmailaddress=
>>
>> ######### xml_factory.py ########
>> from mapnik.ogcserver.WMS import BaseWMSFactory
>> from mapnik import *
>>
>> class WMSFactory(BaseWMSFactory):
>> def __init__(self):
>> BaseWMSFactory.__init__(self)
>> self.loadXML('c:/ms4w/Apache/htdocs/wms/population.xml')
>> self.finalize()
>>
>> ##### apache httpd.conf ####
>>
>> <Directory "/ms4w/Apache/htdocs/wms/">
>> PythonPath "['c:\ms4w\Apache\htdocs\wms\'] + sys.path"
>> AddHandler mod_python .py
>> PythonHandler wms
>> </Directory>
>>
>>
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.berlios.de/pipermail/mapnik-users/attachments/20100126/c3e646ee/attachment.html>
More information about the Mapnik-users
mailing list