Friday, August 27, 2010

Mapnik label cut off strategies

I've been spending a lot of time dealing with mapnik labels/shields being cut off. Here are some strategies:

  1. change the "buffer_size" property of the map object in the mapnik xml ... you can also direclty change this in (which comes with osm mapnik package). I don't think the mapnik xml was being read in my case. When I changed the line self.m.buffer_size to = 0, my cutoff problems disappear
  2. you'll need to do some tweaking with the order layers are defined within mapnik/cascadenik
  3. also tweaking of text-allow-overlap and text-avoid-edges (these are cascadenik properties, there are similarly named ones for mapnik alone)
  4. you may need to merge segments of the same road
To sum up: my strategy was first getting all my ordering straightened out with how layers are defined/ordered within mapnik/cascadenik. I then turned most layers to text-avoid-edges and text-allow-overlap to true. I set the buffer value to 0 in the .py file that I was using to render my tiles (in the osm package). Then moving around stuff that overlapped badly and will possibly need to merge segments of the same road.

Tuesday, August 10, 2010

ImportError: No module named mapnik

I'm still not sure what exactly causes this error: "ImportError: No module named mapnik" .. clearly Python is not finding the mapnik bindings, but why?  I think it might be related to a new install of ArcGIS, which installs a new version of Python.  I am also trying to figure out how exactly to fix this.  Recently I relaunched "cmd" and that worked.