I might be thinking about this all wrong, but right now I'm using Mapnik's OGC Server, and using that WMS with OpenLayers. How would I group multiple layers (say country, water, state borders) into one layer, so that all of those combined show up as a Base Layer in OpenLayers? I'm trying to do this through the Python API.
Tell me more
×
Geographic Information Systems Stack Exchange is a question and answer site for
cartographers, geographers and GIS professionals. It's 100% free, no registration required.
|
The idea of WMS is that you can request multiple layers (from OpenLayers) and the OGCServer will combine them into one image before returning the image. But the trick here is that the WMS spec requires a style for each layer, so this will likely lead to an error being thrown by the OGCServer:
var wms = new OpenLayers.Layer.WMS("Mapnik WMS","http://localhost:8000?",
{layers: ['one','two','three'], styles:[''],format:'image/png'},
{ isBaseLayer: true } );
Because you need to do: styles:['','','']. Or you can use a trick of requesting all layers in the mapfile which avoids having to specify an equal number of real or empty styles:
var wms = new OpenLayers.Layer.WMS("Mapnik WMS","http://localhost:8000?",
{layers: ['__all__'], styles:[''],format:'image/png'},
{ isBaseLayer: true } );
|
|||
|