Modify

Opened 9 months ago

Last modified 3 weeks 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)

21432.patch (27.2 KB) - added by taylor.smock 9 months ago.
21432.2.patch (49.4 KB) - added by taylor.smock 9 months ago.
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).
21432.3.patch (87.1 KB) - added by taylor.smock 8 months ago.
Load tiles in non-EDT thread. Still kind of jerky, but a lot better. Zoom still broken.
21432.4.patch (92.8 KB) - added by taylor.smock 8 months ago.
Zoom fixed, panning broken for non-tiled images (panoramic images not yet checked)

Download all attachments as: .zip

Change History (19)

Changed 9 months ago by taylor.smock

Attachment: 21432.patch added

Changed 9 months ago by taylor.smock

Attachment: 21432.2.patch added

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).

comment:1 in reply to:  description Changed 9 months ago by skyper

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 Changed 9 months ago by Don-vip

Keywords: tile zoom added
Milestone: 21.10

Changed 8 months ago by taylor.smock

Attachment: 21432.3.patch added

Load tiles in non-EDT thread. Still kind of jerky, but a lot better. Zoom still broken.

Changed 8 months ago by taylor.smock

Attachment: 21432.4.patch added

Zoom fixed, panning broken for non-tiled images (panoramic images not yet checked)

comment:3 Changed 8 months ago by Don-vip

Cc: StephaneP added; Don-vip removed

comment:4 Changed 8 months ago by 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).

comment:5 in reply to:  4 Changed 8 months ago by taylor.smock

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 Changed 8 months ago by Don-vip

Milestone: 21.1021.11

comment:7 Changed 6 months ago by Don-vip

Milestone: 21.1121.12

Milestone renamed

comment:8 Changed 6 months ago by Don-vip

Milestone: 21.1222.01

comment:9 Changed 5 months ago by stoecker

Milestone: 22.0122.02

Milestone renamed

comment:10 Changed 5 months ago by Don-vip

Milestone: 22.0222.03

comment:11 Changed 3 months ago by stoecker

Milestone: 22.0322.04

comment:12 Changed 7 weeks ago by taylor.smock

Ticket #22060 has been marked as a duplicate of this ticket.

comment:13 Changed 7 weeks ago by stoecker

Milestone: 22.0422.05

Milestone renamed

comment:14 Changed 7 weeks ago by taylor.smock

Milestone: 22.05Longterm

comment:15 Changed 3 weeks ago by taylor.smock

This might allow us to close #15574.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain taylor.smock.
as The resolution will be set.
to The owner will be changed from taylor.smock to the specified user.
The owner will change to taylor.smock
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.