[Tilecache] OpenLayers, Tilecache and Custom Map using ImageLayer
Nathan Boettcher
NathanB at lawtonprinting.com
Thu May 22 19:10:02 EDT 2008
Hi All,
I toyed with it some more and went with the ImageLayer config option as
someone suggested rather than using the gdal2tiles tool and trying to use
the output. So far it works, but I have a bit of a snag. It only shows
half the map! Basically, using OpenLayers if I zoom all the way out at 0
magnification I can see a single tile with the entire map (and a little bit
of black). Once I zoom in I only get the bottom half of the map. I am
totally clueless as to why Tilecache is only generating and showing me tiles
for the lower half of the map. Anyone got any ideas? Is it OpenLayers
somehow? Below is my config and OpenLayers code:
Tilecache.cfg
-------------------
[tilecache_options]
path=G:/mapserver/
[cache]
type=Disk
base=G://mapserver/cache
[test]
type=ImageLayer
file=G:/mapserver/test.jpg
bbox=0,0,4000,5038
filebounds=0,0,4000,5038
maxresolution=16
OpenLayers:
--------------------
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var map, layer;
OpenLayers.Layer.TMS.prototype.getURL = function ( bounds ) {
bounds=this.adjustBounds(bounds);
var res=this.map.getResolution();
var
x=Math.round((bounds.left-this.tileOrigin.lon)/(res*this.tileSize.w));
var
y=Math.round((bounds.bottom-this.tileOrigin.lat)/(res*this.tileSize.h));
var z=this.map.getZoom();
var
path=/*this.serviceVersion+"/"+*/this.layername+"/"+z+"/"+x+"/"+y+"."+this.t
ype;
var url=this.url;
if(url instanceof Array)
{
url=this.selectUrl(path,url);
}
return url+path;
};
function init(){
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.TMS("Test TMS",
"http://devmaps/tilecache.py/", {layername: 'test',
type:'png',},{maxResolution: 16});
map.addLayer(layer);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.zoomToMaxExtent();
}
// -->
</script>
Note that I had to use the modified getURL function to rip the service
version out of the URL to get it to work. Other than it doesn't show the
top half of the map it seems to work ok. Any and all help is greatly
appreciated.
Thanks,
Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/tilecache/attachments/20080522/1555d79f/attachment.html
More information about the Tilecache
mailing list