-
Notifications
You must be signed in to change notification settings - Fork 23
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
Rename tile.x and tile.y to tile.tx and tile.ty? #15
Comments
I'm down to rename tile.x and tile.y to tile.tx and tile.ty. From the outset I kind of felt the array representation was a bit opaque. If we're using named properties for What are your thoughts on this idea: var d = {
x: 1, // previously d[0]
y: 5, // previously d[1]
z: 4, // previously d[2] - naming in-line with the URL templates in the Leaflet world
tx: 256, // (x without wrapping logic applied) * 256
tz: 1280 // y * 256
}; |
I've made two PRs for two alternative representations. Which do you prefer?
|
The object seems like the simplest approach, yeah. I can’t think of any great wins by using the array representation. Sometimes it’s nice to use arrays for 2D points because the default toString behavior on [x, y] can be embedded into a transform, such as |
Right, I thought of string generation too as one possible win for the array. If the ordering were "http://" + "abc"[d[1] % 3] + ".tile.openstreetmap.org/" + d.join("/") + ".png"; }) But even here, I think I would prefer to see: "http://" + "abc"[d[1] % 3] + ".tile.openstreetmap.org/" + d.z + "/" + d.x + "/" + d.y + ".png"; }) I'll move ahead with the object version (#20) and merge it once documentation is updated. |
I feel like the distinction between tile[0] and tile.x is too small (or that the names are easily confused), especially since typically we substitute tile[0] as the %x variable in a URL template.
Maybe the names tile.tx and tile.ty would be better? Especially if they are premultiplied? Although I guess d3.zoomTransform uses {x, y, k}, so, I dunno.
The text was updated successfully, but these errors were encountered: