I have Mapnik set up on Ubuntu. Tirex directs rendering requests from an OpenLayers client browser to Mapnik, which is set up to use the xml file below.

<?xml version="1.0" encoding="utf-8"?>
<Map background-color="#eeebe2" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">

    <Style name="ocean">
            <PolygonSymbolizer fill="blue" />
    <Layer name="ocean" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
            <Parameter name="type">shape</Parameter>
            <Parameter name="file">ocean</Parameter>


Tiles are generated, but they are all single-color #eeebe2 (from the Map's background-color attribute). The polygons in the ocean shapefile do not appear.

How can I make the tiles that are generated reflect the polygons in the shapefile?

As an aside, I can run the following simple python script manually, and it outputs the image using the style that is defined in the xml file. So I am missing some sort of step related to generating the tiles. Is it a projection thing? A server setting?

mapxmlfile = 'teststyle.xml'
outputfile = 'outimage.png'
m = mapnik.Map(800, 600)
mapnik.load_map(m, mapxmlfile)
mapnik.render_to_file(m, outputfile)
  • As sometimes is the case, I seem to have stumbled upon the answer shortly after posting this. Changing the srs of the <Map> tag to +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 has done the trick. – susie derkins Nov 5 '14 at 19:00

As I mentioned in my comment:

Changing the srs of the tag to +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 has done the trick

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.