Modify

Opened 4 years ago

Closed 3 years ago

#12681 closed defect (fixed)

Imagery tiles adjacent to ±180° are not shown

Reported by: Zverikk Owned by: team
Priority: major Milestone: 16.08
Component: Core imagery Version: latest
Keywords: tiles, 180 degrees, regression, projection Cc: bastiK, wiktorn, michael2402

Description (last modified by Zverikk)

  1. Start JOSM.
  2. Add an imagery layer (e.g. OpenStreetMap).
  3. Zoom out to z4, or just scroll to 180° east or west.

Tiles near the border are hidden. Even not adjacent: sometimes it's 3-4 columns of tiles.
This is clearly a regression.

Narrowed it down to r9558, a change in AbstractProjection#eastNorth2latlon.
Obviously wrapping of coordinates does not work wrt the viewport, since the center can be moved well off the map.

Attachments (0)

Change History (32)

comment:1 Changed 4 years ago by Zverikk

Description: modified (diff)

comment:2 Changed 4 years ago by Zverikk

Description: modified (diff)

comment:3 Changed 4 years ago by Zverikk

Description: modified (diff)

comment:4 Changed 4 years ago by Klumbumbus

Keywords: regression added

comment:5 Changed 4 years ago by Don-vip

Cc: bastiK wiktorn added
Keywords: projection added
Milestone: 16.03

comment:6 Changed 4 years ago by Don-vip

Milestone: 16.0316.04

Milestone renamed

comment:7 Changed 4 years ago by Don-vip

@bastiK: do you know how to fix this?

comment:8 Changed 4 years ago by bastiK

In TileSet(EastNorth topLeft, EastNorth botRight, int zoom) coordinates are converted from EastNorth to LatLon, then in line 1218 converted back to EastNorth (sort of). It should help to use the EastNorth coordinates directly for tile index calculation.
Edit: Would only work if current projection is set to Mercator.

Last edited 4 years ago by bastiK (previous) (diff)

comment:9 Changed 4 years ago by wiktorn

That's my approach to this bug. Looks a bit dirty, but I do not have a better idea for now:

  • src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    diff --git src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
    index 6467fe7..b934223 100644
    implements ImageObserver, TileLoaderListener, ZoomChangeListener { 
    12221222            y0 = t1.getYIndex();
    12231223            x1 = t2.getXIndex();
    12241224            y1 = t2.getYIndex();
     1225            double centerLon = Main.getProjection().eastNorth2latlon(Main.map.mapView.getCenter()).lon();
     1226
     1227            if (topLeft.lon() > centerLon) {
     1228                x0 = tileSource.getTileXMin(zoom);
     1229            }
     1230            if (botRight.lon() < centerLon) {
     1231                x1 = tileSource.getTileXMax(zoom);
     1232            }
    12251233
    12261234            if (x0 > x1) {
    12271235                int tmp = x0;

It checks, where the center of the map is pointing to, to detect, from which side we are getting close to 180 meridian. It still fails, if you zoom out, and the world map takes less than half a screen.

I guess that we could also drop the x0 and x1 switch, that comes just after newly added code.

Shall I commit?

comment:10 Changed 4 years ago by bastiK

Certainly an improvement.

Since there doesn't seem to be a proper way to fix this, I'm starting to doubt if r9558 was correct. On a 3D globe, 181 degrees and -179 degrees longitude are the same point, but on the screen they may correspond to two different points in projected screen coordinates.

Last edited 4 years ago by bastiK (previous) (diff)

comment:11 in reply to:  10 Changed 4 years ago by wiktorn

Replying to bastiK:

Certainly an improvement.

Since there doesn't seem to be a proper way to fix this, I'm starting to doubt if r9558 was correct. On a 3D globe, 181 degrees and -179 degrees longitude are the same point, but on the screen they may correspond to two different points in projected screen coordinates.

Indeed, not limiting LatLon to -180,180 degrees within JOSM core, will simplify handling such situations. To show imageries across 180 meridian, we do need minor tweaks around TileSet and in TileSource.

So what do we do for this release?

comment:12 Changed 4 years ago by bastiK

I would prefer to do a possible revert of [9558] after the upcoming release.

As for the patch, I let you decide. :-)

comment:13 Changed 4 years ago by wiktorn

Ok, I can commit the patch as I propose, but no sooner than this evening. It should be then rollback'ed together with [9558]

comment:14 Changed 4 years ago by wiktorn

In 10155/josm:

Temporary fix for #12681.

Check, from which side we are approaching 180 meridian and use min/max X tile as index.

During planned rollback of [9558] this change should be also removed

See: #12681

comment:15 Changed 4 years ago by wiktorn

Milestone: 16.0416.05

comment:16 Changed 4 years ago by bastiK

[10155] caused a regression, see #12810.

comment:17 Changed 4 years ago by wiktorn

In 10167/josm:

Fix for large imagery offsets.

See: #12681
Closes: #12810

comment:18 Changed 4 years ago by wiktorn

@bastiK, @Don-vip: will you be release'ing hotfix with this patch, or this will go with next release?

comment:19 Changed 4 years ago by bastiK

I don't think a hotfix is needed specifically for #12810. But with [10166] pressing for Java 8 switch and other bugfixes it may be a good idea to update the tested version once more. Vincent, any opinion?

comment:20 Changed 4 years ago by bastiK

Updated tested to r10168.

comment:21 Changed 4 years ago by Don-vip

is this ticket fixed, or is there still something to do?

comment:22 Changed 4 years ago by Zverikk

I think there is.
Start JOSM, open an empty layer and zoom to ~100 km. Scroll to a map edge.
Add a Bing imagery layer, wait for tiles to load and zoom in.
Now tiles are pixelated, so move inside the map bounds, for tiles to load.
Move to the map edge and back. You will see how tiles become pixelated again, and detailed when an edge is not visible.

comment:23 Changed 4 years ago by Klumbumbus

There is also strange behavior when you zoom out till the end.

  • When you reach the lowest zoomlevel and zoom out more it zooms in one step and then again out an in an so on (while always turning the mousewheel the same direction)
  • When you move the map to the left or right the imagery disappears. You can see this especially in the low zoom levels since the half earth is missing then.

comment:24 in reply to:  21 Changed 4 years ago by wiktorn

Replying to Don-vip:

is this ticket fixed, or is there still something to do?

Proper fix, that @bastiK mentioned.

bastiK:

I would prefer to do a possible revert of [9558] after the upcoming release.

I'm not sure, if reverting [9558] should be followed by some other changes.

comment:25 Changed 4 years ago by Don-vip

Milestone: 16.0516.06

ok let's do it for next release then.

comment:26 Changed 3 years ago by Don-vip

Milestone: 16.0616.07

comment:27 Changed 3 years ago by wiktorn

In 10534/josm:

Do not use 180 meridian hack when drawing tiles from different zoom

  • 180 meridian hack works improperly, when tileset doesn't cover whole screen. In case when we are creating small tilesets, we do not execute the hack
  • always load placeholder tile if the tile is not loaded
  • use shifted LatLon when computing the tileset for tiles from different zoom level

See: #12681
Closes: #13147

comment:28 Changed 3 years ago by Don-vip

Cc: michael2402 added

is it fixed?

comment:29 Changed 3 years ago by michael2402

No, the problem is still there in the current version.

comment:30 Changed 3 years ago by Don-vip

Milestone: 16.0716.08

comment:31 Changed 3 years ago by michael2402

A fix is contained in the patch of #13287

comment:32 Changed 3 years ago by Don-vip

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.