[Tilecache] Overlaying Google map Fail with OL.Layer.TileCache but work with OL.Layer.WMS!?

Etides etienne.desgagne at roche.ca
Sun Aug 16 17:03:00 EDT 2009


Hi,

    I use Tilecache (2.10) on Windows to generate tiles from a WMS service I
created with the GIS Manifold (this GIS do not support the SphericMercator).
I’m using Openlayers  (2.8) to create a OpenLayers.Layer.WMS that call the
tilecache.py script to generate the tiles that I overlay over 2 bases map
(Google & Virtual Earth). Switching to any one of this 2 base map let me see
correctly my tiles over the base map. So far so good…

The problem is when I add a second layer of type OpenLayers.Layer.TileCache
to reach directly the tiles from disk generated earlier with the WMS. In
this case, ONLY the overlay with the Virtual Earth work, the tiles are not
showing when switching to the Google base map (I got red crosses for each
tiles). 
When looking for the properties of the tile in error, I got
../05/000/000/008/000/000/007.png as URL. I got
…04/000/000/008/000/000/007.png when looking for the same tile (that work)
when overlaying Virtual Earth.

Someone can explain me why the overlay of a Google base map do work with a
WMS layer but do not work when accessing the same tiles but directly from
disk? Why is it working with VE!??

Here is the code:
 
function init()
        {           	   
            map = new OpenLayers.Map('map');    
            		
            var goo = new OpenLayers.Layer.Google("GMaps", {type:
G_HYBRID_MAP });
            var ve = new OpenLayers.Layer.VirtualEarth( "VE Aerial" );
            map.addLayers([goo,ve]);
            
            // --- Tilecache layer WMS            
            var tc_wms = new OpenLayers.Layer.WMS( "My layer
WMS","tilecache.py?", 
            {    layers: 'Derechos Mineros',
	    format: 'image/png'//,
                 //maxExtent: new OpenLayers.Bounds(-82, -19, -68, 1)//,				
}, 
	{isBaseLayer: false});

	map.addLayer(tc_wms);		        
					
            // --- Tilecache layer... to get tiles directly from disk...					
            var tc_cache = new OpenLayers.Layer.TileCache("My layer from
disk",["http://PERCAN1/tilecache/Cache"], 
            "Derechos Mineros",
{'format':'image/png',transparent:'true',opacity: 0.5,'isBaseLayer':
false});
            map.addLayer(tc_cache);					

            map.addControl( new OpenLayers.Control.LayerSwitcher() );
            map.addControl( new OpenLayers.Control.MousePosition() );
			
            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
            if (!map.getCenter()) map.zoomToMaxExtent();
        }

The code from tilecache.cfg:

[Derechos Mineros]
type=WMS
layers=Derechos Mineros
url=http://PERCAN1/test_wms/wms.asp?transparent=true
extension=png

Thanks a lot

Etienne
-- 
View this message in context: http://n2.nabble.com/Overlaying-Google-map-Fail-with-OL.Layer.TileCache-but-work-with-OL.Layer.WMS%21--tp3454905p3454905.html
Sent from the TileCache mailing list archive at Nabble.com.



More information about the Tilecache mailing list