-
Notifications
You must be signed in to change notification settings - Fork 986
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
TilesOverlay showing tiles at wrong positions when scrolling the map #1509
Comments
@mikebravoyes I noticed this effect too sometimes. What happens if you zoom out or move the map just a little bit (programmatically or by hand)? |
@mat8854 If the map is invalidated periodically (e.g. by a CompassOverlay, which "fires" twice per second), we have some flickering tiles, coming and going irregularly all the time. It's a pity that I'm not able to catch this behaviour in a screenshot. |
I could not reproduce the bug with the demo app ("Sample withTiles Overlay"). |
@monsieurtanuki And I couldn't identify any remark in the respective release notes, that would refer to this behaviour. |
@monsieurtanuki Anyway, here is the short film sequence in mp4 format and zipped: In the first few seconds, I have scrolled the map manually, in the 2nd half it is updated by the CompassOverlay. |
Nice video ;)
|
Additional thoughts:
@mikebravoyes My suggestion: for test purposes, could you please increase the size of the cache of both providers. Something like provider.getTileCache().setAutoEnsureCapacity(false);
provider.getTileCache().ensureCapacity(100); |
Okay, I watched the video. Your problem is even worse than the effect I had in mind. |
@monsieurtanuki 1.) Just a step aside: Talking about osmdroid versions, did you see my issue #1500 ? 2.) But back to our topic: You said you could not reproduce the problem with the demo app. Where can I find the source code of that demo? I have “stolen” my code from github here, but something essential must be different. 3.) You are talking about 2 TilesOverlay s. Maybe it’s just a matter of terminology, but we have just 1 “background map” (MapView with MAPNIK) plus 1 TilesOverlay (PUBLIC_TRANSPORT). In the video we see some more overlays (Copyright, ScaleBar, Grid, Compass, MiniMap and NorthArrow), but they don’t affect the behaviour in question – except the fact, that the compass is triggering the periodic refresh of the whole map. In the 1st screenshot above, there are only 2 layers: The MapView plus 1 TileOverlay. (The 2 icons in the upper right corner are defined in the layout.xml, not part of the map.) 4.) Two more observations: 5.) Test with MapView = PUBLIC_TRANSPORT only and video 6.) Test with MapView (PUBLIC_TRANSPORT) plus TilesOverlay (MAPNIK) on top: As expected, the MAPNIK fills the whole area completely, without any gap, covering anything below. No “crazy tiles” visible. I don’t take a screenshot of that. 7.) Test with provider.getTileCache() as proposed by you: No difference in the effect. 8.) I made also tests with the entry in AndroidManifest.xml “android:hardwareAccelerated”. There is no difference, if it’s true or false. |
I saw #1500, but I have no clue about it. About the demo app, it's SampleWithTilesOverlay I've just managed to reproduce the bug with Btw there's a mandatory (and kind of hidden) |
@mikebravoyes Correct me if I'm wrong:
|
@monsieurtanuki to 2.) Yes! I have tested also OPEN_SEAMAP, FIETS_OVERLAY_NL and ROADS_OVERLAY_NL (the latter 2 with MapView = BASE_OVERLAY_NL). I could not see the effect here. Obviously, it only happens with PUBLIC_TRANSPORT. |
Why should it happen only with PUBLIC_TRANSPORT?
For the moment, I believe that there's an issue with the Well, that's enough for today. |
@monsieurtanuki Concerning the tile size: As far as I can see during the population of the map with content, they have a similar size (if not identical) to the base map (MAPNIK). OK, thanks for today! |
Well, I think I've got it. Partially. The first step is to clear the bitmap when it comes from the pool: I can do it. Tomorrow ;) |
I think the problem is around providing, displaying or copying transparent bitmaps. |
To be honest, I understood not half of what you were saying yesterday. Anyway, I hope you are on the right track. |
Interesting. I did not expect to be crystal clear either, it's a work in progress. |
Hmm, 3 puzzling concepts, let’s see: 1.) What is the bitmap pool – in contrast to the cache and its garbage collector? Is there a difference between tile and bitmap? 2.) What is the “approximation” of a tile? (If I had to guess, I would say it has to do with the zoom level.) 3.) Why has a tile from the pool to be cleared before using it and what has this to do with transparency? I think, something like a flow diagram would be very helpful for the doc. |
Let me tell you about my professional background: Recently, I was retired, but before that I was working for companies which produce ECDIS and VTS systems. Both of these have as major component a sea chart, defined by specifications from two international organisations: IMO and IALA. Like OSM, such a sea chart is composed of different layers: For the composition of such a chart, you can buy an ECDIS kernel from companies like 7Cs (spoken “seven seas”) or you can do it yourself, like SAM Electronics. The chart material is generated by official authorities (in Germany: BSH) and distributed in encrypted format, because you have to pay for its usage. From the technical point of view, the major difference is, that the map elements are given in object oriented format. For example a buoy is defined by its geographical position and some attributes, which specify its type. It says nothing about the graphical representation of such an object. This has been defined by a special “colours and symbols working group” and is affected by different parameters: Every layer is composed of cells (similar to your tiles), which have attributes like the cell corners and the level of visibility. When a map is constructed, each cell is either disregarded (due to zoom level or user setting) or it is taken, transformed by the projection (mostly Mercator, but others are also possible), and saved in its respective layer, where it is finally displayed on the screen. That’s it – straightforward. What I want to say: I’m rather familiar with the composition of a chart display, but I never heard of such thing as an “approximation of tiles”. |
What is the bitmap pool?osmdroid spends its time displaying tiles. What is the “approximation” of a tile?Typically, tiles are downloaded from the internet then stored in the local SQLite database. Why has a tile from the pool to be cleared before using it?Work in progress (to be confirmed):
That would explain why you see unrelated bitmaps (from the pool) in places where you're supposed to see an approximation of a transparent tile. |
OK, understood - every single point! Of course, there is a big difference between an ECDIS system and OSM on a smartphone. Not only the hardware platform, but also the strategy how the data is made available. So please excuse my ignorance. At least, my assumption that "approximation" has to do with the zoom level, was correct. |
… images Impacted classes: * `DefaultOverlayManager`: unrelated minor fix * `IMapTileProviderCallback`: unrelated minor refactoring * `MapTileApproximater`: Android bug fixes for method `getTileBitmap` - when we get a bitmap from the pool, now we explicitly make it totally transparent * `SampleWithTilesOverlay`: minor changes - `TileSourceFactory.PUBLIC_TRANSPORT`, `setLoadingBackgroundColor(Color.TRANSPARENT)` - in order to be able to reproduce the bug more easily if needed
I'm glad it helped! |
bug/#1509 - Android bug fixes for MapTileApproximater and transparent images
Great! Natural laws are still in place ;-) The wording "approximation" is in fact a little bit misleading. I would have called it substitute, surrogate, replacement or something like that. Anyway, if it's working, that's what counts. Will there be a new release 6.1.6 soon, or how can I access the modified version? |
Personally I would do it like a pig: I would download the whole latest source code and copy it in my app. |
@monsieurtanuki
Rather frustrating experience - like poking around in the dark. I give up and wait for the next release. Sooner or later it will appear. Thank you for your patient support. The communication with you was a real pleasure :-) |
I can cut one today
…On Sat, Mar 7, 2020, 11:41 AM Michael L. Braun ***@***.***> wrote:
@monsieurtanuki <https://github.com/monsieurtanuki>
Following these instructions
<https://github.com/osmdroid/osmdroid/wiki/How-to-build-osmdroid-from-source>,
after several hours I was able to succeed with the section "Building with
Gradle". But the next step "Building osmdroid with Android Studio" failed
with the following error message:
*Unsupported Modules Detected*
Compilation is not supported for following modules: osmdroid.
Unfortunately you can't have non-Gradle Java modules and Android-Gradle
modules in one project.
Rather frustrating experience - like poking around in the dark. I give up
and wait for the next release. Sooner or later it will appear.
Thank you for your patient support. The communication with you was a real
pleasure :-)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1509?email_source=notifications&email_token=AAPCIGNWICXPV65LDKMJI53RGJ2J7A5CNFSM4LAGMDNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOD52OY#issuecomment-596106555>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPCIGKXSF7ONSNL5QOAXTLRGJ2J7ANCNFSM4LAGMDNA>
.
|
@spyhunter99 That would be great! @mikebravoyes "Rather frustrating experience": I know exactly how you feel ;) |
@spyhunter99 Thank you for release 6.1.6! |
@monsieurtanuki |
@monsieurtanuki All other tile sources that I have tested, are OK. No idea, what is so special about this map type. I checked with all osmdroid releases between 6.1.2 (still OK) and 6.1.6. The failure was obviously introduced earlier with 6.1.3. Its releases notes say:
|
Looks like an unrelated issue. |
@monsieurtanuki I'm still using osmdroid 6.1.6. Deleting the cache files did not make a difference. Any ideas? |
What you say is that now, some tiles of PUBLIC_TRANSPORT never appear, am I correct? They don't disappear suddenly. |
@monsieurtanuki Some tiles appear, and some don't. But the gaps are not constant. When I zoom in and out a little bit, the appearance toggles between the 2 screenshots above. That is probably not caused by the tile source, except there was something wrong with the tiles' attributes (e.g. visibility as a function of the zoom level). At least the existing tiles are all in the right place. |
@monsieurtanuki |
Issue Type
[x] Bug
Description and/or steps/code to reproduce the problem
I have written an app with a map component, based on osmdroid 6.1.2. As long as I use only one “basic map” (e.g. MAPNIK, HIKEBIKEMAP, OpenTopo, etc) everything is OK. But as soon as an additional TilesOverlay comes into play (e.g. PUBLIC_TRANSPORT) there is a very strange effect: When the map is zoomed or scrolled, suddenly appears a wild mixture of tiles from MAPNIK and PUBLIC_TRANSPORT at wrong positions, mainly on more or less empty regions, like the sea area. With every movement of the map, the picture changes unpredictable.
Here is a screenshot (North Sea area close to the coasts of the Netherlands and Germany), which demonstrates the effect. The dynamic behaviour during the scroll process can’t be visualized here, but the static conditions are clearly visible in the upper left region of the screen.
This effect remains, even after all tiles are downloaded completely - checked with TileStates.getUpToDate();
mapView.invalidate(); doesn't help either.
Code snippets:
and in the related layout.xml:
Btw: Other overlay types, such as Copyright, ScaleBar, Grid, Compass, MiniMap, etc. don't cause these problems.
Any ideas, where this effect comes from and how to repair it?
Environment
Tested on different devices with android versions from 4.0.3, 4.1.2, 4.4.2, 8.0 up to 9.0, no difference concerning the effect
Version of osmdroid the issue relates to:
6.1.2
The text was updated successfully, but these errors were encountered: