-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
d3.geoTile #35
Comments
Make a d3-geo-tile module? It is pretty tiny though. |
It is tiny, and I'd love to be able to use Rollup with it. Maybe it could be included as-is in d3-geo? It also seems like there's room for building a higher level module on top of the existing tile code for working with images. Currently each of the examples re-implements image loading logic separately, along the lines of the following (from Raster & Vector II): var raster = svg.append("g");
...
function zoomed() {
...
var image = raster
.attr("transform", "scale(" + tiles.scale + ")translate(" + tiles.translate + ")")
.selectAll("image")
.data(tiles, function(d) { return d; });
image.exit()
.remove();
image.enter().append("image")
.attr("xlink:href", function(d) { return "http://" + ["a", "b", "c"][Math.random() * 3 | 0] + ".tile.openstreetmap.org/" + d[2] + "/" + d[0] + "/" + d[1] + ".png"; })
.attr("width", 1)
.attr("height", 1)
.attr("x", function(d) { return d[0]; })
.attr("y", function(d) { return d[1]; });
} I wonder if it might make sense to try to encapsulate this logic into an API similar to that of Leaflet. The API could take as input the
The higher-level API idea may justify setting up a separate d3-geo-tile package that can start as the pure and simple tile code as it exists, and be built up over time towards the higher-level API for working with images. |
Here's an example that demonstrates d3.geoTile working on 4.0 Alpha 49: Raster & Vector 4.0. |
Related library for using D3 on map tiles (Leaflet integration) https://github.com/Telefonica/submarine Hat tip to @micahstubbs for pointing out this library. |
Perhaps one upgrade to geoTile could be to accept a zoom transform rather than setting the translate and scale separately. |
The Raster & Vector 4.0 example was actually using D3 3.X functions before for zooming. I just updated the example to actually work on the 4.0 API only (Alpha 50). |
Nice. A little comment. When you call zoom.transform, it will invoke your zoom event listeners. So there’s no reason to call svg.call(zoom.transform, initialTransform); // Calls zoomed!
vector.attr("d", path(topojson.mesh(us, us.objects.counties))); And then in console.log(d3.event.transform); Updated fork: http://bl.ocks.org/mbostock/e94d145a60278eada9945de3d630680e |
Oh sweet! Awesome improvements. Thanks so much for the code review. |
Embarking on creating a plugin. Is this still up to date? https://bost.ocks.org/mike/d3-plugin/ |
Yes. I’ve been keeping it up-to-date. Do you mind transferring it over the D3 organization and restoring my original LICENSE? You’ve substituted your name for mine, and it’s still my code. Thanks! |
(You’ll still be an owner after the transfer; it’ll make it easier for both of us to maintain it.) |
Also, if you could add me as an owner so that I can publish to npm, that would be nice.
|
I think that error is misleading—you just need to be a member of the d3 organization to create new repositories. I’ve just set you an invite. Let me know if that works. If not, you might need to transfer for it to me first, and then I can transfer it over to d3 and add you as an owner. |
Ah ok, thanks! Will try again. |
Nice! |
The geo tile plugin would be a stellar addition in the 4.0 world.
Related: d3/d3#486
The text was updated successfully, but these errors were encountered: