Hi Rob,

This is my code.

 - in tilecache.cfg -

[osm]
type=Mapnik
debug=on
mapfile=/var/mapnik/osm.xml
bbox=-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892
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
maxResolution=156543.0399
srs=EPSG:900913
spherical_mercator=true
metaTile=yes
metaBuffer=40

 - in index.html - 


        function init(){
            var options = {
                 controls: [
                        new OpenLayers.Control.Navigation(),
                        new OpenLayers.Control.PanZoom(),
                        new
OpenLayers.Control.LayerSwitcher({'ascending':true}),
                        new OpenLayers.Control.Permalink(),
                        new OpenLayers.Control.ScaleLine(),
                        new OpenLayers.Control.Permalink('permalink'),
                        new OpenLayers.Control.MousePosition(),
                        new OpenLayers.Control.KeyboardDefaults()
                    ],

                projection: new OpenLayers.Projection("EPSG:900913"),
                displayProjection: new
OpenLayers.Projection("EPSG:4326"),             
                maxExtent: new
OpenLayers.Bounds(-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],
                maxResolution: 156543.0399,
                units: 'm',
                numZoomLevels: 19

            };
            map = new OpenLayers.Map('map', options);

            var wms = new OpenLayers.Layer.WMS("Osm",
                "tilecache.py?", {
                    layers: "osm",
                    format: "image/png",
                "sphericalMercator": true,

                 }
        );

                map.addLayers([wms]);

                map.setCenter(new OpenLayers.LonLat(lon, lat).transform(new
OpenLayers.Projection("EPSG:4326"),new
OpenLayers.Projection("EPSG:900913")),zoom);


        }

I hope i help you.

Best regards,
Ramón.


El sáb, 01-08-2009 a las 05:12 -0700, rob777 escribió:
> I hope someone can help.
> 
> I have Mapnik up and all examples are working.
> 
> I have Tilecache up and it's example is working.
> 
> When trying to get the two to work it fails.
> 
> Can some one please tell us or point us to documentation on the proper way
> to use these two togeather.
> 
> My tilecache.cfg looks like this.
> [tad]
> type=mapnik
> mapfile=C:\data_dir\data\shapefiles\tad.xml
> extension=png
> metaTile=yes 
> spherical_mercator=true
> tms_type=google
> 
> My OpenLayers Looks like this.
> <script type="text/javascript">
>         <!--
>         var map, layer;
> 
>         function init(){
>             map = new OpenLayers.Map( $('map'), {'maxResolution': 360/512});
>             layer = new OpenLayers.Layer.WMS( "mapnik", 
>                     "tilecache.py?", {layers: 'tad', format: 'image/png' }
> );
>             map.addLayer(layer);
>             map.addControl(new OpenLayers.Control.Permalink());
>             if (!map.getCenter()) map.zoomToMaxExtent();
>         }
>         // -->
>     </script>
> 
> 
> Any help is appreciated.
> 
> Thanks,
> Rob

_______________________________________________
Mapnik-users mailing list
Mapnik-users@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to