[OpenLayers-Users] Openlayers and Mapnik - Problems generating
maps in OL with XML (Mapnik)
Ivan Grcic
igrcic at gmail.com
Wed Mar 18 12:55:29 EDT 2009
hi,
var mapnikwms = new OpenLayers.Layer.WMS("MapnikWMS",
"http://gaia.geo.at/cgi-bin/mapnikwms.py?",
{
layers:['staat01','grenzen'],
styles:'staat01_style,grenzen_style',
format:'image/png'
}
);
should work,
cheers
2009/3/18 "tschobber tschöbbi" <tschobber at gmx.at>
>
> Hi,
>
> I'm trying to run a Mapnik XML file with Openlayers. To do so I have a python class named XML_Factory.py (see code below). I'm able to make a WMS request with just one single layer -> that's working fine, but if I specify another layer with another style I get the following exception in Openlayers and via Mapnik WMS request:
>
> "OGCException: STYLES length does not match LAYERS length."
>
> I solved this problem by specifying more than one style to the STYLES parameter in the mapnik wms request command line. But how am I able to do so in Openlayers? Here's the Mapnik WMS request command line:
>
> http://localhost/cgi-bin/mapnikwms.py?LAYERS=staat01,grenzen&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=staat01_style,grenzen_style&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=%20384619.116883103,467965.222077892,505102.701298797,534231.193506524&WIDTH=640&HEIGHT=640
>
> This is how I request WMS Mapnik in Openlayers script file:
>
> var mapnikwms = new OpenLayers.Layer.WMS("MapnikWMS","http://gaia.geo.at/cgi-bin/mapnikwms.py?",{layers:['staat01','grenzen'], format:'image/png'});
>
> Thanks for any help.
>
> Martin
>
>
> XML_Factory.py:
>
> --------------------------------------------------
>
> from mapnik.ogcserver.WMS import BaseWMSFactory
>
> class WMSFactory(BaseWMSFactory):
> def __init__(self):
> BaseWMSFactory.__init__(self)
>
> self.loadXML('world_styles2.xml')
> self.finalize()
>
> ----------------------------------------------------
> --
> Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Ivan Grcic
More information about the Users
mailing list