question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TilesOverlay showing tiles at wrong positions when scrolling the map

See original GitHub issue

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.

Screenshot_North_Sea

This effect remains, even after all tiles are downloaded completely - checked with TileStates.getUpToDate(); mapView.invalidate(); doesn’t help either.

Code snippets:

// create background map
mapView = (MapView) findViewById(R.id.mapview);
mapView.setTileSource(TileSourceFactory.MAPNIK);

// create overlay map
MapTileProviderBasic tileProvider = new MapTileProviderBasic(getApplicationContext());
tileProvider.setTileSource(TileSourceFactory.PUBLIC_TRANSPORT);
TilesOverlay tilesOverlay = new TilesOverlay(tileProvider, this.getBaseContext());
tilesOverlay.setLoadingBackgroundColor(Color.TRANSPARENT);
mapView.getOverlays().add(tilesOverlay);

// enable zoom
mapView.setMultiTouchControls(true);
mapView.setBuiltInZoomControls(false);

// initialize position + zoom level
IMapController mapController = mapView.getController();
GeoPoint geoPoint = new GeoPoint(53.6, 5.3);  // north sea
mapController.setCenter(geoPoint);
mapController.setZoom(8.0);

and in the related layout.xml:

<org.osmdroid.views.MapView
	android:id="@+id/mapview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:36 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
monsieurtanukicommented, Mar 8, 2020

@spyhunter99 Thank you for release 6.1.6! @mikebravoyes Please test and close the issue if relevant.

1reaction
spyhunter99commented, Mar 7, 2020

I can cut one today

On Sat, Mar 7, 2020, 11:41 AM Michael L. Braun notifications@github.com 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 https://github.com/osmdroid/osmdroid/issues/1509?email_source=notifications&email_token=AAPCIGNWICXPV65LDKMJI53RGJ2J7A5CNFSM4LAGMDNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOD52OY#issuecomment-596106555, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPCIGKXSF7ONSNL5QOAXTLRGJ2J7ANCNFSM4LAGMDNA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

My Tile Is Showing an Incorrect Location
If your app is not displaying the right location of your Tile on the map, here are a few ... For iOS devices:...
Read more >
A trick to fix incorrectly sorted overlapping tiles in Unity
This is a simple solution to a problem where there is a tile such as a mountain so high that it overlaps the...
Read more >
wrong position of tile map when i convert to retina display
Coding example for the question wrong position of tile map when i convert to retina display.
Read more >
Wrong Leaflet.js tiles position, snaps into place on drag
I'm having trouble with a Leaflet bug (?) - when adding a layer, the tiles are in wrong position, and will only snap...
Read more >
Tilemaps and Scrolling
[ ] How do we convert between world coordinates and tile coordinates? [ ] How do tilemaps make implementing simple box collision easier?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found