Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zoomlevel shift between Mapsforge and VTM #217

Closed
Klaus-Tockloth opened this issue Oct 30, 2016 · 14 comments
Closed

Zoomlevel shift between Mapsforge and VTM #217

Klaus-Tockloth opened this issue Oct 30, 2016 · 14 comments
Labels

Comments

@Klaus-Tockloth
Copy link

It seems that there is a basic zoomlevel shift by minus one (-1) in VTM. In other words: What I get in Mapsforge in ZL 18 is equal to what I get in VTM in ZL 17.

Mapsforge zoomlevel 18:
screenshot_2016-10-30-06-15-38

VTM zoomlevel 17:
screenshot_2016-10-30-06-07-37

@devemux86
Copy link
Collaborator

VTM has continuous zooming, so if you zoom a little more at start of 18, you'll see the Mapsforge equivalent fixed zoom.

Mapsforge:
mapsforge

VTM:
vtm

@Klaus-Tockloth
Copy link
Author

Continuous zooming? The usage of the plus/minus button in Cruiser GL leads for me to an increment or decrement by one zoomlevel.

Let me explain the issue by an example. Buildings are introduced in zoomlevel 14:

    <m e="way" k="building" v="gebaeude_allgemein" closed="yes" zoom-min="14">
      <area fill="#c1b0af" stroke="#aa94a4" stroke-width="0.1" />
    </m>

Zoomlevel 14 in Cruiser (mapsforge):
screenshot_2016-10-30-13-12-25

Zoomlevel 14 in Cruiser GL (vtm):
screenshot_2016-10-30-13-14-30

As you can by the width (geometry) of the river (rhine), the vtm rendering of the map is one zoomlevel higher as the rendering of mapsforge. In both cases buildings are introduced in zoomlevel 14. Under vtm this is one level to late and not what the map designer intended.

Zoomlevel 15 in Cruiser (mapsforge, only for comparison):
screenshot_2016-10-30-13-12-45

@devemux86
Copy link
Collaborator

devemux86 commented Oct 30, 2016

Continuous zooming?

Yes, try pinch zoom on Android or mouse wheel on Desktop.

The usage of the plus/minus button in Cruiser GL leads for me to an increment or decrement by one zoomlevel.

Zoom buttons can perform level zoom +1 or -1, I could adjust them better so that they end to the "fixed" zoom levels.

Above in "Zoomlevel 14 in Cruiser GL (vtm)" screenshot appears the end of zoom 14.
Zoom a little more and you'll see zoom 15 start (what is Mapsforge 15).

@devemux86
Copy link
Collaborator

@Klaus-Tockloth is there still a problem with the zoom levels?

An easy way to compare the same zoom in both libraries is to use the "Go to" tool and select same settings.

@Klaus-Tockloth
Copy link
Author

@Klaus-Tockloth is there still a problem with the zoom levels?

Yes, the issue with the zoomlevel is not solved. For me this defect is cruicial because it breaks compatibility between mapsforge and vtm.

Let me try to explain it:

The rendering of a map object (e.g. a landuse=water) is defined:

  • primary in the map data (map-writer, e.g. zoomlevel 10)
  • secondary in the theme (e.g. zoomlevel 12)

Result in mapsforge: rendering starts at zoomlevel 12
Result in vtm: rendering starts at zoomlevel 13 (!)
Expectation for vtm: rendering should also start at zoomlevel 12

BTW: As a "quick hack" in the theme which I have provided for testing, I have decreased all zoomlevel entries (min, max) by one (e.g. 12 -> 11). But this could not be the solution, because for a lot of objects the zoomlevel is defined within the map data (map-writer) and can not be changed.

@devemux86
Copy link
Collaborator

devemux86 commented Nov 2, 2016

Unless I'm overlooking something obvious here, probably you didn't understood my explanation? 🙂
BTW I have not seen any offset in map elements zoom appearance.

Could you do a quick test?
Open Cruiser and Cruiser GL (Android or Desktop) on same device, so that tile size is the same.
Then use the "Go to" tool and go to the same coordinates and zoom level.
You should see the exact same area (and zoom), at least that's what I see in below screenshots.

Note that in Mapsforge the zoom levels are fixed, i.e. ..., 11, 12, 13, ...
In VTM there are no zoom levels, only a continuous scale and the zoom levels are "derived" from it.
Try pinch zoom on Android or Shift + mouse drag on Desktop to see it.

Don't be confused by the debug tile grid in VTM and its mentioned zoom.
Each VTM zoom number starts appearing at Mapsforge's corresponding fixed one.
So you should compare the VTM zoom interval at start and not intermediate scale (not between 12 and 13).

Cruiser
cruiser

Cruiser GL
cruiser_gl

@Klaus-Tockloth
Copy link
Author

Hmm, it seems that this issue is hard to explain ... only look at the blue icon for the filling station:

The first zoomlevel were the icon is visible in mapsforge:
bildschirmfoto 2016-11-02 um 19 57 28

The first zoomlevel were the icon is visible in vtm:
bildschirmfoto 2016-11-02 um 19 57 37

In both cases the icon is rendered starting with zoomlevel 15 (this is correct). But at this point the vtm map looks different (enlarged) compared with the mapsforge map.

      <m cat="tankstelle" e="node"  v="fuel" zoom-min="15" zoom-max="16">
        <symbol id="tankstelle"  src="file:/symbols/amenity_fuel.svg"  symbol-width="14" />
      </m>
      <rule cat="tankstelle" e="node" k="*" v="fuel" zoom-min="15" zoom-max="16">
        <symbol id="tankstelle" display="always" src="file:/symbols/amenity_fuel.svg" symbol-scaling="size" symbol-width="14" />
      </rule>

@devemux86
Copy link
Collaborator

devemux86 commented Nov 2, 2016

VTM screenshot (looking also at scale bar) is clearly more zoomed than Mapsforge, so you are not in zoom 15 interval start but somewhere between zoom 15 and 16.

How did you go to that zoom in VTM, with mouse wheel?
Can you try with N, M buttons or with Shift + mouse drag slowly?
Or with "Go to" tool set zoom 15 to go straight to that.

I changed in your theme just the above rule and at zoom 15 start the symbol appears and the map is the same with Mapsforge:
cruiser_gl

@Klaus-Tockloth
Copy link
Author

Great ... your last screenshot shows exactly what I expect.

How did you go to that zoom in VTM, with mouse wheel?

Yes, I switch the zoomlevels with the mouse wheel (btw: I'm on OS X).

Can you try with N, M buttons or with Shift + mouse drag slowly?

With the N and M keys it works as expected (see screenshots).
Very peculiar: After that, also zooming with the mouse wheel works as expected.

But this reproduces the defect for me:

  • loading map AAA
  • loading map BBB
  • loading map AAA

Maybe an initialization problem.

bildschirmfoto 2016-11-03 um 17 30 45

bildschirmfoto 2016-11-03 um 17 30 53

@devemux86
Copy link
Collaborator

devemux86 commented Nov 3, 2016

Desktop mouse wheel or Android zoom buttons or any other control performing zoom in predefined steps, progresses from current scale by a fixed percentage. So the start clearly affects the result.

BTW check Cruiser GL keyboard shortcuts in Help menu, they're quite handy. 🙂

Are maps AAA and BBB from different regions?
Then after loading, the map zooms appropriately to show most of it and probably ends somewhere in between.
So subsequent zooms via the controls are not guaranteed ending to fixed levels.

@Klaus-Tockloth
Copy link
Author

Are maps AAA and BBB from different regions?
Yes.

@devemux86
Copy link
Collaborator

@Klaus-Tockloth can we close this?

I don't see VTM zoom having anything wrong, the fixed zoom levels are the same with Mapsforge.

@Klaus-Tockloth
Copy link
Author

Yes I agree, this issue can be closed. The VTM library is working compatible with the Mapsforge lib. The point here was an issue within the app (which uses VTM): The app must ensure the correct handling of the continous zoomlevel feature.

@devemux86
Copy link
Collaborator

Ok I'm closing this, thanks @Klaus-Tockloth for the useful conversation!
Regarding the app will need to think a little for future improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants