--- a/pngtile/tile.py Sat Oct 04 03:03:17 2014 +0300
+++ b/pngtile/tile.py Sat Oct 04 03:28:57 2014 +0300
@@ -43,7 +43,7 @@
Scale value about center by zoom.
"""
- return scale(val, zoom) - dim / 2
+ return scale(val - dim / 2, zoom)
class TileApplication (pngtile.application.PNGTileApplication):
# age in seconds for caching an unknown-mtime image for revalidates
--- a/static/pngtile/map.js Sat Oct 04 03:03:17 2014 +0300
+++ b/static/pngtile/map.js Sat Oct 04 03:28:57 2014 +0300
@@ -26,12 +26,16 @@
var map_zoom = map.getZoom();
var size = map.getSize();
+ var x = (+map_center.lng) * Math.pow(2, map_config.tile_zoom);
+ var y = (-map_center.lat) * Math.pow(2, map_config.tile_zoom);
+ var zoom = map_config.tile_zoom - map_zoom;
+
var state = {
w: size.x,
h: size.y,
- x: (+map_center.lng) << map_config.tile_zoom,
- y: (-map_center.lat) << map_config.tile_zoom,
- z: map_config.tile_zoom - map_zoom,
+ x: x >> zoom,
+ y: y >> zoom,
+ z: zoom
};
var url = L.Util.template(this.options.url, L.extend(state, this.options));