I've gone through the process of setting up my own OSM database / tile server by setting up PostGIS, importing the Planet.osm data snapshot (took a few days), and setup Mapnik / cascadenik, etc. I can manually render my own sample tiles with generate_image.py
and I can manually produce tilesets with generate_tiles.py
. I've spend a decent amount of time generating my own custom style template using cascadenik and generated tiles from it, which I'm quite happy with.
My new issue is setting up a sample slippy map with OpenLayers to run on the same server...
I've got it somewhat configured and working; setup Apache, mod_python, TileCache, etc. It renders tiles into the slippy map, but I think I've got the parameters all screwed up in OpenLayers. Here's what I've got currently (which renders what looks like empty ocean at all zoom levels):
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">
var map;
function init() {
map = new OpenLayers.Map ("map", {
maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
maxResolution: 156543.0399,
numZoomLevels: 19,
units: 'm',
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326")
} );
layer = new OpenLayers.Layer.TMS( "OSM", "/tilecache/tilecache.py/", {layername: 'osm', type: 'png'} );
map.addLayer(layer);
map.addControl(new OpenLayers.Control.PanZoomBar());
map.setCenter(new OpenLayers.LonLat(-82.686195, 27.84788), 12)
}
</script>
</head>
<body onload="init()">
<div id="map"></div>
</body>
</html>
I feel that something's wrong with the layer options parameters, but I can't find good documentation describing the standard parameters to be used for displaying general OSM tiles rendered by Mapnik...
Is there something obvious that I'm missing that would cause this problem?
Here's all I have in the tilecache.cfg, too:
[cache]
type=Disk
base=/tmp/tilecache
[osm]
type=Mapnik
spherical_mercator=true
mapfile=/home/user/mapfile.xml