Skip to content

Commit bab7548

Browse files
no tile requests for images outside the y boundary
1 parent cf0c767 commit bab7548

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

js/tracker.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,28 +184,28 @@ var maptypes = {
184184
'OpenStreetMaps.org',
185185
1,
186186
19,
187-
function(xy,z) { return 'http://'+['a','b','c'][Math.round(Math.random()*2)]+'.tile.openstreetmap.org/'+z+'/'+wrapTiles(xy.x,z)+'/'+xy.y+'.png'; }
187+
function(xy,z) { var n = Math.pow(2,z); return (xy.y<0 || xy.y>=n) ? null : 'http://'+['a','b','c'][Math.round(Math.random()*2)]+'.tile.openstreetmap.org/'+z+'/'+wrapTiles(xy.x,z)+'/'+xy.y+'.png'; }
188188
],
189189
osm_bw: [
190190
'OSM B&W',
191191
'OSM Black & White',
192192
1,
193193
16,
194-
function(xy,z) { return 'http://'+['a','b','c','d','e'][Math.round(Math.random()*2)]+'.www.toolserver.org/tiles/bw-mapnik/'+z+'/'+wrapTiles(xy.x,z)+'/'+xy.y+'.png'; }
194+
function(xy,z) { var n = Math.pow(2,z); return (xy.y<0 || xy.y>=n) ? null : 'http://'+['a','b','c','d','e'][Math.round(Math.random()*2)]+'.www.toolserver.org/tiles/bw-mapnik/'+z+'/'+wrapTiles(xy.x,z)+'/'+xy.y+'.png'; }
195195
],
196196
osm_toner: [
197197
'OSM Toner',
198198
'Stamen.org Toner',
199199
1,
200200
18,
201-
function(xy,z) { return 'http://'+['a','b','c','d'][Math.round(Math.random()*2)]+'.tile.stamen.com/toner/'+z+'/'+wrapTiles(xy.x,z)+'/'+xy.y+'.png'; }
201+
function(xy,z) { var n = Math.pow(2,z); return (xy.y<0 || xy.y>=n) ? null : 'http://'+['a','b','c','d'][Math.round(Math.random()*2)]+'.tile.stamen.com/toner/'+z+'/'+wrapTiles(xy.x,z)+'/'+xy.y+'.png'; }
202202
],
203203
osm_watercolor: [
204204
'OSM Watercolor',
205205
'Stamen.org Watercolor',
206206
1,
207207
18,
208-
function(xy,z) { return 'http://'+['a','b','c','d'][Math.round(Math.random()*2)]+'.tile.stamen.com/watercolor/'+z+'/'+wrapTiles(xy.x,z)+'/'+xy.y+'.png'; }
208+
function(xy,z) { var n = Math.pow(2,z); return (xy.y<0 || xy.y>=n) ? null : 'http://'+['a','b','c','d'][Math.round(Math.random()*2)]+'.tile.stamen.com/watercolor/'+z+'/'+wrapTiles(xy.x,z)+'/'+xy.y+'.png'; }
209209
]
210210
}
211211

@@ -238,11 +238,11 @@ function load() {
238238
// register custom map types
239239
for(var i in maptypes) {
240240
map.mapTypes.set(i, new google.maps.ImageMapType({
241-
getTileUrl: maptypes[i][4],
241+
name: maptypes[i][0],
242242
minZoom: maptypes[i][2],
243243
maxZoom: maptypes[i][3],
244+
getTileUrl: maptypes[i][4],
244245
tileSize: new google.maps.Size(256, 256),
245-
name: maptypes[i][0]
246246
}));
247247
}
248248

0 commit comments

Comments
 (0)