[Tilecache] Google Maps Overlay (image offset)

Josh Livni josh at umbrellaconsulting.com
Fri Jun 8 14:43:30 EDT 2007


Hi,

I'm trying to overlay some tilecache images w/Google Maps.  It's 
certainly theoretically possible (see Tim Schaub's demo at 
http://dev.openlayers.org/sandbox/tschaub/google/examples/google-mercator.html) 


However, when I try use the Google API outside of OpenLayers, I get 
strange results.  Mainly, it seems the tiles that tilecache returns are 
shifted a bit - by a consistent geographical amount for most zoom 
levels, and by a large amount for a few zoomed out levels.
I spent much of yesterday looking at the code and setting some more 
debug notes, but ended up almost as confused as when I started. Here are 
a couple examples showing level 0.  The first one, a direct mapserver 
request, aligns perfectly on GMaps.  The 2nd, to Tilecache, has the same 
bbox but returns an offset image:
http://mapserver.eactive.org/cgi-bin/mapserv?map=/home/josh/tmp/world.map&TRANSPARENT=true&&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&LAYERS=world&STYLES=&FORMAT=image/gif&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&SRS=EPSG:54004&BBOX=-20037508.03516647,-19994872.957813744,20037508.03516647,19994874.171103183&WIDTH=256&HEIGHT=256&reaspect=false 


http://mapserver.eactive.org/tilecache/tilecache.py?TRANSPARENT=true&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&LAYERS=world&STYLES=&FORMAT=image/gif&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&SRS=EPSG:54004&BBOX=-20037508.03516647,-19994872.957813744,20037508.03516647,19994874.171103183&WIDTH=256&HEIGHT=256&reaspect=false 


An example showing these two layers together can be found at 
http://gmaps.eactive.org/tctest.html

It seems strange to me that not only does tilecache returns an offset 
image, but that OpenLayers deals with that perfectly - aligning the 
offset images nicely on top of Google Maps as shown in Tim's demo.
My tilecache layer config is:
[world]
type=WMSLayer
srs=EPSG:54004
bbox=-20040000,-26334952,20035017,13740066
resolutions=156543.031524,78271.515762,....,4.77731419445801
levels=16
url=http://mapserver.eactive.org/cgi-bin/mapserv?map=/home/josh/tmp/world.map&TRANSPARENT=true& 

extension=gif
debug=true

If anyone has any clues as to how to get tilecache's grid cells(?) to 
align more nicely with the GMap layout of the world, it would be greatly 
appreciated.

Thanks,

 -Josh




More information about the Tilecache mailing list