[OSM-dev] New tiling code
crschmidt at crschmidt.net
Wed Jun 28 14:06:51 BST 2006
Currently, the OpenStreetMap tile.js code does not round its values.
This results in bounding boxes that are off by very very very small
values when you're at high zooms, and probably depend on client-specific
rounding errors. This is bad because then you've missed your cache for
// make a key
var key = this.url + "?WIDTH="+(this.tilewidth)+"&HEIGHT="+
Is where the url comes from, one could change this to be:
lt = Math.round(lt*1000000) / 1000000;
tp = Math.round(tp*1000000) / 1000000;
rt = Math.round(rt*1000000) / 1000000;
bt = Math.round(bt*1000000) / 1000000;
6 decimal places gets you within pixel error ranges on everything you'd
need, while at the same time preventing the 17th decimal place rounding
errors that cause you to blow your cache.
If you want more explanation, or can point to an svn copy of tile.js so
I make an actual patch, please let me know.
More information about the dev