Allow d3.geo.tile to fetch margin tiles (beyond viewport covering)

This commit is contained in:
Bryan Housel
2018-06-22 12:24:40 -04:00
parent d41cf5e6d8
commit fb324dd865
2 changed files with 79 additions and 58 deletions
+6 -3
View File
@@ -89,12 +89,15 @@ function getTiles(projection) {
s / 2 - projection.translate()[1]
];
return d3_geoTile()
var tiler = d3_geoTile()
.scaleExtent([tileZoom, tileZoom])
.scale(s)
.size(projection.clipExtent()[1])
.translate(projection.translate())()
.map(function (tile) {
.translate(projection.translate())
.margin(1); // request nearby tiles so we can connect sequences.
return tiler()
.map(function(tile) {
var x = tile[0] * ts - origin[0];
var y = tile[1] * ts - origin[1];
return {