mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
Support other tilesets, xyz tiles, etc. Fixes #130
This commit is contained in:
@@ -50,6 +50,8 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="iD"></div>
|
||||
<script>iD(document.getElementById('iD'));</script>
|
||||
<script>
|
||||
iD(document.getElementById('iD'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -149,6 +149,8 @@ var iD = function(container) {
|
||||
d3.select('.user').call(iD.userpanel(connection)
|
||||
.on('logout', connection.logout)
|
||||
.on('login', connection.authenticate));
|
||||
|
||||
return map;
|
||||
};
|
||||
|
||||
iD.supported = function() {
|
||||
|
||||
@@ -510,6 +510,7 @@ iD.Map = function(elem, connection) {
|
||||
|
||||
map.selectEntity = selectEntity;
|
||||
|
||||
map.tileclient = tileclient;
|
||||
map.center = center;
|
||||
map.centre = center;
|
||||
map.getZoom = getZoom;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
iD.Tiles = function(selection, projection) {
|
||||
var t = {},
|
||||
template = 'http://ecn.t{t}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=587&mkt=en-gb&n=z',
|
||||
tile = d3.geo.tile();
|
||||
|
||||
// derive the url of a 'quadkey' style tile from a coordinate object
|
||||
@@ -14,7 +15,12 @@ iD.Tiles = function(selection, projection) {
|
||||
}
|
||||
// distribute requests against multiple domains
|
||||
var t = coord[2] % 5;
|
||||
return 'http://ecn.t' + t + '.tiles.virtualearth.net/tiles/a' + u + '.jpeg?g=587&mkt=en-gb&n=z';
|
||||
return template
|
||||
.replace('{t}', t)
|
||||
.replace('{u}', u)
|
||||
.replace('{x}', coord[0])
|
||||
.replace('{y}', coord[1])
|
||||
.replace('{z}', coord[2]);
|
||||
}
|
||||
|
||||
// derive the tiles onscreen, remove those offscreen and position tiles
|
||||
@@ -29,7 +35,7 @@ iD.Tiles = function(selection, projection) {
|
||||
return "scale(" + tiles.scale + ")translate(" + tiles.translate + ")";
|
||||
})
|
||||
.selectAll("image")
|
||||
.data(tiles, function(d) { return d; });
|
||||
.data(tiles, function(d) { return [d.join(), template].join(); });
|
||||
|
||||
image.exit()
|
||||
.remove();
|
||||
@@ -48,6 +54,13 @@ iD.Tiles = function(selection, projection) {
|
||||
return t;
|
||||
}
|
||||
|
||||
t.template = function(x) {
|
||||
if (!arguments.length) return template;
|
||||
template = x;
|
||||
redraw();
|
||||
return t;
|
||||
};
|
||||
|
||||
t.setSize = setSize;
|
||||
t.redraw = redraw;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user