-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Default to OSM z/x/y.png format, provide TMS (with y flipped) as an option #15
Comments
Well that's confusing! Explains why I need the datasette-tiles/datasette_tiles/templates/tiles_explorer.html Lines 36 to 41 in f7aa1a4
Maybe I could also support the OSM format directly at a different path - have I want to make this change ASAP because it's a breaking change for anything consuming tiles served by this plugin. Need to make sure I fully understand the options first. Anything I should read about this? |
I want to match what the other MBTiles implementations are doing: https://github.com/mapbox/mbtiles-spec/wiki/Implementations https://github.com/infostreams/mbtiles-php/blob/a7258d140788156bf3ad8eff7585ad65fac379c7/tileserver.php#L31-L39 is interesting: $r->map("1.0.0/:layer/:z/:x/:y:is_retina.:ext",
array("controller" => "maptile", "action" => "serveTmsTile"),
array("layer" => $_identifier, "x" => $_number, "y" => $_number, "z" => $_number,
"is_retina" => $_retina, "ext" => "(png|jpg|jpeg|json)"));
$r->map(":layer/:z/:x/:y:is_retina.:ext",
array("controller" => "maptile", "action" => "serveTile"),
array("layer" => $_identifier, "x" => $_number, "y" => $_number, "z" => $_number,
"is_retina" => $_retina, "ext" => "(png|jpg|jpeg|json)")); Note that the if (!$this->is_tms) {
$this->y = pow(2, $this->z) - 1 - $this->y;
} |
This one lets you pass an origin = self.get_arguments('origin')
try:
origin = origin[0]
except IndexError:
origin = 'bottom'
if origin == 'top':
# invert y axis to top origin
ymax = 1 << int(z);
y = ymax - int(y) - 1; |
I feel like I've stumbled into some kind of weird multi-decade battle between geographers here that I don't understand the implications of! |
Useful background information from @tmcw: https://gist.github.com/tmcw/4954720
|
I think I'll go with XYZ by default and offer TMS as an option - maybe at |
I need to check that I understand how this issue affects the MBTiles files I'm creating with https://github.com/simonw/download-tiles |
I'll use this to calculate the y = int(math.pow(2, z) - 1 - y) |
As I understand it, mbtiles stores the y co-ordinate in the reverse of the standard OSM z/x/y notation. OSM has y=0 at the top counting down, whereas mbtiles have y=0 at the bottom counting up. For example, currently you have https://datasette-tiles-demo.datasette.io/-/tiles/basemap/4/8/9.png equal to https://tile.openstreetmap.org/4/8/6.png (so Y(osm) = 2^Z - Y(mbtile) - 1 and vice-versa). For ease of translating from one to the other (and perhaps with your proxy suggestion) it would be good if it could use the standard z/x/y co-ordinates for tile URLs, I think.
The text was updated successfully, but these errors were encountered: