Integer overlow issues when using large area map files and zooming in

10 переглядів
Перейти до першого непрочитаного повідомлення

b3nn0

не прочитано,
29 квіт. 2021 р., 07:31:0529.04.21
Кому: Mapsforge & VTM

Hi,
I noticed that the map vanishes when zooming in a lot while using a larger map file (e.g. Germany, or even a MultiMapFile with multiple countries).
Similar issues had been discussed/fixed here: https://github.com/mapsforge/mapsforge/issues/572
but this is a different one.

While rendering itself seems to work just fine, the issue happens afterwards when trying to fill the background.

Relevant code:
DatabaseRenderer uses canvasRasterer.fillOutsideAreas() and passes it the MapFile's bounding box (coordinates relative to the tile boundary).
When zooming in a lot, this can easily become -1E9/1E9.
CanvasRasterer then uses setClipDifference and casts all parameters to int (as the canvas wants it). However, these ints will then overflow.

If I can see it correctly, AwtCanvas could work with double based clipping just fine, but Android's canvas can not? I guess a custom workaround would be needed for this? Any idea for a fix?

Emux

не прочитано,
29 квіт. 2021 р., 07:37:2229.04.21
Кому: mapsfo...@googlegroups.com
What large zoom?

Because all map libraries have a max zoom limit.

--
Emux

b3nn0

не прочитано,
29 квіт. 2021 р., 07:40:3729.04.21
Кому: Mapsforge & VTM
Well, depends on the size of the map file of course.
For germany.map, it happens at zoom 28, so not that bad. For the large MultiMapFile I'm using in practice (pretty much whole world), it happens at zoom 23 IIRC. Which is not terrible, but also not optimal for high precision applications (RTK GPS and stuff like that)

Emux

не прочитано,
29 квіт. 2021 р., 07:57:2129.04.21
Кому: mapsfo...@googlegroups.com
Mapsforge maps though not designed for indoor mapping,
they store coordinates in microdegrees (degrees × 1E6).

This is a precision of (around) 11 cm:
https://wiki.openstreetmap.org/wiki/Precision_of_coordinates

Usually a max zoom 20-22 should be enough for most cases.
(like most other map engines, Google Maps, Mapbox, etc)

--
Emux
Відповісти всім
Відповісти автору
Переслати
0 нових повідомлень