Modify

Opened 6 years ago

Closed 6 years ago

#18289 closed defect (fixed)

Download map is misaligned

Reported by: maarten Owned by: team
Priority: normal Milestone: 19.11
Component: JMapViewer Version: latest
Keywords: regression zoom download bounds Cc: wiktorn

Description (last modified by Klumbumbus)

In JOSM 15492 when I press the download button (ctrl-shift-down), no map is shown. When I zoom out a lot, the zoom 0 map is shown completely at the right side of the screen. So it appears that the map is misaligned when you want to download something.
See screenshot.

Also, when pasting a link from the openstreetmap site to go to a download area, the map moves away again, even when you are zoomed in to roughly the correct area.


Attachments (1)

misaligned_map.png (96.3 KB ) - added by maarten 6 years ago.

Download all attachments as: .zip

Change History (21)

by maarten, 6 years ago

Attachment: misaligned_map.png added

comment:1 by maarten, 6 years ago

Description: modified (diff)

comment:2 by maarten, 6 years ago

Description: modified (diff)

comment:3 by mdk, 6 years ago

JOSM remembers the last bounding box you used in this dialog. Next time you open this dialog, the last bounding box is shown. For me it looks like JOSM uses a "strange" bBox for this.

This setting is stored in the preference file. Can you please go to "Preferences" -> "Setting Preference entries directly. Use with caution!". This panel is only visible, if you activate the "Expert Mode" (Checkbox at the button of "Preference" window). Search for "osm-download.bounds" and post the value here (it should be lat and lon for lower left and upper right corner).

comment:4 by Don-vip, 6 years ago

Description: modified (diff)
Owner: changed from team to maarten
Priority: majornormal
Status: newneedinfo

comment:5 by Don-vip, 6 years ago

Description: modified (diff)

comment:6 by Don-vip, 6 years ago

Please post your full status report.

comment:7 by maarten, 6 years ago

Description: modified (diff)
Priority: normalmajor

In the advanced preferences, osm-download.bounds is set to 51.2913382;5.7640457;51.302394;5.7897949
When I go to the download dialog and zoom out and go to that area, the downloadbox is set there. But the map does not center there.
Even when I download data and go back to the download dialog, the map behaves the same: no map visible and when I zoom out it's all the way to the left.

It looks like JOSM wants to display the map at longitude -354.2359543 and not at 5.7640457.

Version 0, edited 6 years ago by maarten (next)

comment:8 by Don-vip, 6 years ago

Priority: majornormal

comment:9 by Klumbumbus, 6 years ago

Description: modified (diff)

comment:10 by Don-vip, 6 years ago

Owner: changed from maarten to team
Status: needinfonew

comment:11 by Don-vip, 6 years ago

Please backup your preferences.xml somewhere and try with a fresh profile. Let us know if the problem is still here.

comment:12 by Don-vip, 6 years ago

Owner: changed from team to maarten
Status: newneedinfo

comment:13 by maarten, 6 years ago

Yes that worked. But obviously I'm not going to work with a completely new profile that I have to customise again, so I tried removing the osm-download.bounds key from my preferences and that also solved it.

For info, the key was:

  <tag key='osm-download.bounds' value='51.315742;6.0204017;51.3169845;6.0230605'/>

I tried replicating it by downloading outside of the map, but it looks like the bounds get set in the key correctly.
Very strange behaviour.
I have attached my preferences.xml so you can test to see what goes wrong here.

Last edited 6 years ago by Don-vip (previous) (diff)

comment:14 by Don-vip, 6 years ago

Thanks. I have downloaded the file then deleted it, as it contains your OAuth access token.

comment:15 by Don-vip, 6 years ago

Cc: wiktorn added
Component: CoreCore imagery
Keywords: regression zoom download bounds added
Milestone: 19.11

Problem comes from these preference entries:

  <maps key='imagery.entries'>
    <map>
      <tag key='name' value='OpenStreetMap'/>
      <tag key='type' value='tms'/>
      <tag key='url' value='http://tile.openstreetmap.org/{zoom}/{x}/{y}.png'/>
      <tag key='attribution-text' value='© OpenStreetMap contributors, CC-BY-SA'/>
      <tag key='attribution-url' value='http://openstreetmap.org/'/>
    </map>
    <map>
      <tag key='name' value='OpenStreetMap Carto (Standard)'/>
      <tag key='id' value='standard'/>
      <tag key='type' value='tms'/>
      <tag key='url' value='https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png'/>
      <tag key='attribution-text' value='© OpenStreetMap contributors, CC-BY-SA'/>
      <tag key='attribution-url' value='https://www.openstreetmap.org/'/>
      <tag key='max-zoom' value='19'/>
      <tag key='cookies' value=''/>
      <tag key='icon' value='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAGb0lEQVR4Xq3MS2xcVx3H8e855z7m3vH1jMdjO43zshIrtpM0SZ3WFEcRVFFKoRWPBYtAHwg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>
      <tag key='modTileFeatures' value='true'/>
      <tag key='customHttpHeaders' value='{}'/>
      <tag key='transparent' value='true'/>
      <tag key='minimumTileExpire' value='3600'/>
      <tag key='category' value='osmbasedmap'/>
    </map>
  </maps>
  <tag key='slippy_map_chooser.mapstyle' value='OpenStreetMap'/>

It works if we change it to:

<tag key='slippy_map_chooser.mapstyle' value='standard'/>

I guess this is a side effect of the change of default max-zoom done in #18064 as you have here a very old imagery entry without any zoom information.

@Wiktor, can you please take a look?

comment:16 by Don-vip, 6 years ago

Owner: changed from maarten to team
Status: needinfonew

comment:17 by wiktorn, 6 years ago

The problem is due to following part of the code in JMapViewer(#302-314):

        if (markers && mapMarkerList != null) {
            synchronized (this) {
                for (MapMarker marker : mapMarkerList) {
                    if (marker.isVisible()) {
                        Point p = tileSource.latLonToXY(marker.getCoordinate(), mapZoomMax);
                        xMax = Math.max(xMax, p.x);
                        yMax = Math.max(yMax, p.y);
                        xMin = Math.min(xMin, p.x);
                        yMin = Math.min(yMin, p.y);
                    }
                }
            }
        }

As you can see, we are calling tileSource.latLonToXY with zoom 24. It means, that Point will overflow, as it can hold only int's, and to be proper we should change the interface of latLonToXY to return custom Point, that uses internally long instead of int.

This was already known bug when committing this change (though I haven't pinpointed it to specific line of code). But fixing that would require total overhaul of types that we use in JOSM.

There is a dirty fix for that (line to be added before the section quoted above):

mapZoomMax =  Math.min(31 - (int) (Math.log(tileController.getTileSource().getDefaultTileSize()) / Math.log(2)), mapZoomMax);

Which prevents using zoom levels for which we overflow when calculating X/Y Coordinates.

This is probably least what we can do, without turning JMapViewer upside down and getting rid of Point class.

comment:18 by Don-vip, 6 years ago

I'm fine with the dirty fix if you add a comment explaining it :)

comment:19 by Don-vip, 6 years ago

Component: Core imageryJMapViewer

comment:20 by wiktorn, 6 years ago

Resolution: fixed
Status: newclosed

Fixed, for reference: [o35224]

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.