Thanks so much for your help. I now (finally!) have a working mapserver...

Here's my tilecache.cfg:

[cache]
type=Disk
base=/tmp/tilecache

[osm]
type=Mapnik
mapfile=/home/eamorr/maps/mapnik/osm.xml
spherical_mercator=true


And here's the html/javascript:

<head>
<style type="text/css">
html, body { height: 100%; }
body {margin: 0px;}
#map{
width: 100%;
height: 100%;
}
</style>
<script src="http://openlayers.org/api/OpenLayers.js";></script>

<script type="text/javascript">
        var map;
        
        function init() {
            
            var options = { 
                maxResolution: 156543.0339,
                units: 'm',
                projection: new OpenLayers.Projection("EPSG:900913"),
                maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
20037508.34, 20037508.34)
            };
            
            map = new OpenLayers.Map("map", options);
            
            
            /*              
            Works with a tilecache.cfg layer entry like:
            
            [osm]
            type=Mapnik
            mapfile=/full/path/to/osm.xml
            spherical_mercator=true
            
            **Your OSM data in postgis must be in EPSG 900913 or Spherical
Mercator**
            
            Edit the below parameters to fit your setup:
            
            */

            
            
            // default url of tilecache_http_server.py
            var server_url =
"http://maps.myserver.com/tilecache/tilecache.cgi?";;
            
            // Must match tilecache config layername
            var layer_name = "osm";
            
            var image_type = "png";
            // force regeneration even if cache is hit
            //var image_type = "png?FORCE=1";
            
            
            var wms = new OpenLayers.Layer.WMS("TileCache Mapnik
Layer",server_url,
                { serviceVersion: "1.0.0", layers: layer_name,  type:
image_type });

            var official_tiles = new OpenLayers.Layer.OSM("Mapnik from
OSM");
            
            map.addLayers([wms,official_tiles]);
            map.addControl(new OpenLayers.Control.Scale('scale'));
            map.addControl(new OpenLayers.Control.Navigation()); 
            map.addControl(new OpenLayers.Control.PanZoom());
            map.zoomToMaxExtent();
                }
</script>
</head>

<body onload="init()">
<div id="map"></div>
</body>


This may be of help to someone in future.

Best wishes from Ireland,

Eamorr





Dane Springmeyer wrote:
> 
> Eamorr,
> 
> Your configuration does not look quite right, and can be more simple.
> 
> I've just added a few example files for you at Mapnik-utils. See:
> 
> http://code.google.com/p/mapnik-utils/source/detail?r=787
> 
> You'll need to point the OL code at your tilecache.cgi or just use the  
> provided (by tilecache) local http server which by default mounts at
> 
> http://localhost:8080
> 
> Cheers,
> 
> Dane
> 
> 
> On Jun 23, 2009, at 6:18 AM, Eamorr wrote:
> 
>>
>> Here's my javascript:
>>
>> var options ={
>>      maxResolution: "auto",
>>      maxExtent: new OpenLayers.Bounds(-10.93, 51.26, -5.21, 55.56),
>>      minResolution: "auto",
>>      resolutions:[156543.03390000001, 78271.516950000005,  
>> 39135.758475000002,
>> 19567.879237500001, 9783.9396187500006, 4891.9698093750003,
>> 2445.9849046875001, 1222.9924523437501, 611.49622617187504,
>> 305.74811308593752, 152.87405654296876, 76.43702827148438,
>> 38.21851413574219, 19.109257067871095, 9.5546285339355475,
>> 4.7773142669677737, 2.3886571334838869, 1.1943285667419434,
>> 0.59716428337097172, 0.29858214168548586],
>>      numZoomLevels: 16,
>>      spherical_mercator: true
>> };
>>              
>> map = new OpenLayers.Map( $('map'), options);
>> layer = new OpenLayers.Layer.WMS( "VMap0","tilecache.cgi?",
>> {
>>        layers: 'osm',
>>      format: 'image/png',
>> });
>> map.addLayer(layer);
>>
>>
>> And here's my tilecache.cfg:
>>
>> [osm]
>> type=Mapnik
>> mapfile=/home/eamorr/maps/mapnik/osm.xml
>> spherical_mercator=true
>> tms_type=google
>> metatile=yes
>> bbox=-10.93, 51.26, -5.21, 55.56
>> resolutions=156543.03390000001, 78271.516950000005,  
>> 39135.758475000002,
>> 19567.879237500001,9783.9396187500006, 4891.9698093750003,
>> 2445.9849046875001, 1222.9924523437501,611.49622617187504,
>> 305.74811308593752, 152.87405654296876, 76.43702827148438,
>> 38.21851413574219, 19.109257067871095, 9.5546285339355475,
>> 4.7773142669677737, 2.3886571334838869, 1.1943285667419434,
>> 0.59716428337097172, 0.29858214168548586
>>
>>
>>
>>
>> The map shows up, but zoomed in very close. On zooming out, I can  
>> eventually
>> see 'Ireland' showing up on the map, but I can't move the map around  
>> and it
>> seems to be stuck in the same position. I feel I'm very close to  
>> getting
>> this map server working, it's just I'm completely stumped.
>>
>> And help is much appreciated.
>>
>> Thanks,
>>
>>
>>
>>
>> Eamorr wrote:
>>>
>>> Greetings,
>>>
>>> I've installed PostGreSQL and PostGIS and sucessfully loaded Ireland
>>> (ireland.osm) into the database.
>>>
>>> I've tried doing the following:
>>>
>>> source set-mapnik-env
>>> ./customize-mapnik-map > $MAPNIK_MAP_FILE
>>> ./generate_tiles.py
>>>
>>> (I've edited set-mapnik-env and generate_tiles as appropriate)
>>>
>>> The problem is, when I run 'generate_tiles.py' - nothing happens!  
>>> No error
>>> messages, nothing, it just quits after a split-second.
>>>
>>> I'm completely stumped and have no idea what to do now.
>>>
>>> Could anyone give me any suggestions?
>>>
>>> Many thanks,
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/generate_tiles.py-problem-tp23997196p24155592.html
>> Sent from the Mapnik - Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Mapnik-users mailing list
>> [email protected]
>> https://lists.berlios.de/mailman/listinfo/mapnik-users
> 
> _______________________________________________
> Mapnik-users mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/mapnik-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/generate_tiles.py-problem-tp23997196p24173246.html
Sent from the Mapnik - Users mailing list archive at Nabble.com.

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to