[OSM-dev] tilecache & mapnik

Jon Burgess jburgess at uklinux.net
Thu Dec 7 01:41:13 GMT 2006


On Wed, 2006-12-06 at 19:18 -0500, Christopher Schmidt wrote:
> On Wed, Dec 06, 2006 at 09:57:29PM +0000, Jon Burgess wrote:
> > I'm trying to get tilecache working with mapnik for OSM data. I've got
> > tilecache working fine with the vmap0 layer. Unfortunately the mapnik
> > layer consists entirely of tiles in the background cream colour. 
> > 
> > Mapnik too works fine on its own rendering tiles via generate_tiles.py
> > etc. 
> > 
> > It looks like it the tilecache with mapnik is so close to working, but
> > only produces these cream tiles. Any clue about what i'm missing? 
> > 
> > 
> > Attached are the html & cfg files that i'm using.
> 
> The default projection for TileCache is 'unprojected', with bounds from
> -180,-90 to 180,90.
> 
> The OSM mapnik xml file uses a Mercator projection.
> 
> Which one do you want? :)
> 
> If the former (Which your OpenLayers map seems to indicate), then you
> want to change the first line of your osm.xml file to:
> 
> <Map bgcolor="#f2efe9" srs="+proj=longlat +datum=WGS84 +no_defs">
> 
> if the latter, you will want a TileCache Layer like:
> 
> [osm-merc]
> type=MapnikLayer
> mapfile=/www/wms-c/osm-merc.xml
> bbox=-20037508.34,-20037508.34,20037508.34,20037508.34
> resolutions=156543.0,78271.5,39135.75,19567.875,9783.9375,4891.96875,2445.984375,1222.9921875,611.49609375,305.748046875,152.874023438,76.4370117188,38.2185058594,19.1092529297,9.55462646484,4.77731323242,2.38865661621,1.19432830811,0.597164154053,0.298582077026
> srs=OSGEO:41001
> metaTile=yes
> metaBuffer=40
> 
> and then set your OpenLayers Map up like:
> 
>             map = new OpenLayers.Map( $('map'), {
> 			  maxResolution: 156543/4, 
> 			  maxExtent: new
> OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34), 
> 			  numZoomLevels: 17,
> 			  projection: 'epsg:41001',
> 			  'units':'m'});
> 
> One of these two solutions should get you started -- changing the first
> line of your osm.xml file is probably easier to get right while you're
> getting started.
> 
> Regards,

Yes, both solutions seem to work. I prefer the mercator projection
since it matches the one used by the main OSM site.

Thanks for your help.

	Jon






More information about the dev mailing list