Opened 3 years ago
Last modified 7 months ago
#21432 assigned enhancement
[WIP PATCH] Tile images so that we can zoom in to full resolution
Reported by: | taylor.smock | Owned by: | taylor.smock |
---|---|---|---|
Priority: | normal | Milestone: | Longterm |
Component: | Core image mapping | Version: | |
Keywords: | tile zoom | Cc: | StephaneP |
Description
I'm using an undocumented Mapillary API for inspiration for this. I won't be using the API in the Mapillary plugin (yet -- I'm going to ask them if they can make the API documented and public, specifically for 360 images). Undocumented api looks like this: /<image_id>/tiles?z=<zoom>&fields=url,z,x,y
.
Example responses:
- Image 514627522880380
{"width":3840,"height":2160,"id":"514627522880380"}
{ "data": [ { "url": "https://example.com", "z": 11, "x": 0, "y": 0 }, { "url": "https://example.com", "z": 11, "x": 1, "y": 0 }, { "url": "https://example.com", "z": 11, "x": 0, "y": 1 }, { "url": "https://example.com", "z": 11, "x": 1, "y": 1 } ] }
{ "data": [ { "url": "https://example.com", "z": 12, "x": 0, "y": 0 }, { "url": "https://example.com", "z": 12, "x": 1, "y": 0 }, { "url": "https://example.com", "z": 12, "x": 2, "y": 0 }, { "url": "https://example.com", "z": 12, "x": 3, "y": 0 }, { "url": "https://example.com", "z": 12, "x": 0, "y": 1 }, { "url": "https://example.com", "z": 12, "x": 1, "y": 1 }, { "url": "https://example.com", "z": 12, "x": 2, "y": 1 }, { "url": "https://example.com", "z": 12, "x": 3, "y": 1 }, { "url": "https://example.com", "z": 12, "x": 0, "y": 2 }, { "url": "https://example.com", "z": 12, "x": 1, "y": 2 }, { "url": "https://example.com", "z": 12, "x": 2, "y": 2 }, { "url": "https://example.com", "z": 12, "x": 3, "y": 2 } ] }
The returned images are 1024x1024, except for those on the bottom/left edges.
At zoom 11, we have a 1x1 return, with a maximum size of 1024x1024.
(0, 1) and (1, 1) is 1024 × 64.
This indicates that the height for the tiled images is 1024 + 64, or 1088.
At zoom 12, we have a 4x3 return, with a maximum size of 4096x3072 (width x height). This is "full resolution".
(3, 2) is 768 × 112.
From this, we see that the maximum size doubles between z11 and z12. Conveniently, 2zoom == max size (211 = 2048, 212 = 4096).
For JOSM internal use, we might want to use 256x256 (I think the imagery tiles use that).
Attachments (4)
Change History (23)
by , 3 years ago
Attachment: | 21432.patch added |
---|
by , 3 years ago
Attachment: | 21432.2.patch added |
---|
comment:1 by , 3 years ago
Replying to taylor.smock:
For JOSM internal use, we might want to use 256x256 (I think the imagery tiles use that).
I thought there have been some changes and it can also be 512x512.
comment:2 by , 3 years ago
Keywords: | tile zoom added |
---|---|
Milestone: | → 21.10 |
by , 3 years ago
Attachment: | 21432.3.patch added |
---|
Load tiles in non-EDT thread. Still kind of jerky, but a lot better. Zoom still broken.
by , 3 years ago
Attachment: | 21432.4.patch added |
---|
Zoom fixed, panning broken for non-tiled images (panoramic images not yet checked)
comment:3 by , 3 years ago
Cc: | added; removed |
---|
follow-up: 5 comment:4 by , 3 years ago
Good start, thanks :) I think zoom works fine now even for panos (it's difficult to be sure without being able to pan).
comment:5 by , 3 years ago
Replying to Don-vip:
Good start, thanks :) I think zoom works fine now even for panos (it's difficult to be sure without being able to pan).
I haven't touched the pano code yet for this patch.
Also explicitly not supported: non-default exif orientations. I'm currently disabling tiling since I *think* I will need to do a bunch of math to convert the tiles to the "right" coordinates (isTilingEnabled
returns false
if there is an orientation change due to exif).
But I was specifically looking at any classes that implemented IImageEntry but not IImageTiling. Right now, the only one I know of is in the Mapillary plugin. I can modify it fairly easily to be tiled, but at that point the Image Viewer would require all image classes to be tiled (not necessarily a bad thing). As of right now, almost all of the business logic is in IImageTiling, so it should be trivially easy for a developer to implement.
Current non-default methods in IImageTiling:
getTileImage(int, int, int, int)
(this is what actually gets the tile image, which is then cached)getDeepTileSet()
(A tile cache, essentially. Very similar to that used for Imagery layers.)getHeight()
(the full height of the image)getWidth()
(the full width of the image)
comment:6 by , 3 years ago
Milestone: | 21.10 → 21.11 |
---|
comment:8 by , 3 years ago
Milestone: | 21.12 → 22.01 |
---|
comment:10 by , 3 years ago
Milestone: | 22.02 → 22.03 |
---|
comment:11 by , 3 years ago
Milestone: | 22.03 → 22.04 |
---|
comment:14 by , 3 years ago
Milestone: | 22.05 → Longterm |
---|
comment:17 by , 15 months ago
Replying to taylor.smock:
I've got a patch that worked for traditional images, but wasn't for spherical (360) images, which is why I haven't merged it. I should probably go back and see if I can figure out how to make it work with 360 images.
Perhaps you could take a look to this plugin. It can display spherical images with full resolution, but there are some problems with the orientation and the max zoom level :
https://github.com/GhostFoxSledgehammer/panoviewer-josm
comment:19 by , 7 months ago
AFAIK, it is still undocumented. I don't think it has changed recently.
Fixes pan/zoom -- zoom does not currently zoom to the appropriate location. Panning works, but is somewhat jerky (image tiles are currently loaded in EDT, I'm looking into reusing JCSCachedTileLoader and related classes).