Modify

Opened 3 years ago

Last modified 7 days 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 3 years ago.
21432.2.patch (49.4 KB ) - added by taylor.smock 3 years 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 3 years 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 3 years ago.
Zoom fixed, panning broken for non-tiled images (panoramic images not yet checked)

Download all attachments as: .zip

Change History (23)

by taylor.smock, 3 years ago

Attachment: 21432.patch added

by taylor.smock, 3 years ago

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

in reply to:  description comment:1 by skyper, 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 Don-vip, 3 years ago

Keywords: tile zoom added
Milestone: 21.10

by taylor.smock, 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 taylor.smock, 3 years ago

Attachment: 21432.4.patch added

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

comment:3 by Don-vip, 3 years ago

Cc: StephaneP added; Don-vip removed

comment:4 by Don-vip, 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).

in reply to:  4 comment:5 by taylor.smock, 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 Don-vip, 2 years ago

Milestone: 21.1021.11

comment:7 by Don-vip, 2 years ago

Milestone: 21.1121.12

Milestone renamed

comment:8 by Don-vip, 2 years ago

Milestone: 21.1222.01

comment:9 by stoecker, 2 years ago

Milestone: 22.0122.02

Milestone renamed

comment:10 by Don-vip, 2 years ago

Milestone: 22.0222.03

comment:11 by stoecker, 2 years ago

Milestone: 22.0322.04

comment:12 by taylor.smock, 2 years ago

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

comment:13 by stoecker, 2 years ago

Milestone: 22.0422.05

Milestone renamed

comment:14 by taylor.smock, 2 years ago

Milestone: 22.05Longterm

comment:15 by taylor.smock, 23 months ago

This might allow us to close #15574.

comment:16 by taylor.smock, 8 months ago

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

comment:17 by StephaneP, 8 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:18 by richlv, 12 days ago

Is that aspect of the Mapillary API still undocumented?

comment:19 by taylor.smock, 7 days ago

AFAIK, it is still undocumented. I don't think it has changed recently.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain taylor.smock.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from taylor.smock to the specified user. Next status will be 'new'.
Next status will be 'needinfo'. The owner will be changed from taylor.smock to taylor.smock.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. 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.