20

I would like my TileOverlay to behave like the real Google Maps. When you zoom in, the tile is still visible but pixelized until the new tile is downloaded.

The current behavior is: when you zoom in, tiles disappear and you see the ugly grid, and the user has to wait until the new tiles are loaded. This is kind of annoying.

Is there a solution to this problem?

ron4ex
  • 1,073
  • 10
  • 21
vital
  • 1,308
  • 3
  • 13
  • 28
  • This Links are helpful.please refer this links. [Link1](https://github.com/googlemaps/android-samples/tree/master/ApiDemos) [Link2](https://developers.google.com/maps/documentation/android-api/tileoverlay) – MIkka Marmik Oct 24 '16 at 09:44
  • hi, I face the same issue now. Did you find the solution? – Rustam Ibragimov Oct 16 '18 at 11:54
  • the main issue is that googlemaps doesn't even start calling TileProvider#getTile while there is a camera movement – Jan Rabe Jul 24 '19 at 09:03

2 Answers2

1

I worked around this issue by "preloading" all zoomlevels before showing the map (just a copy/paste of the current state, need to clean up):

@UiThread
private void preloadAllZoomLevels(final float zoomLevel) {
    if (zoomLevel == map.getMaxZoomLevel()) {
        map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 7));
        mapFragmentContainer.animate().alpha(1f);
        return;
    }
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), zoomLevel));

    final float nextZoomLevel = zoomLevel + 1;
    map.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
        @Override
        public void onMapLoaded() {
            preloadAllZoomLevels(nextZoomLevel);
        }
    });
}
Boy
  • 7,010
  • 4
  • 54
  • 68
-2

Essentially, every time GoogleMap wants to draw tile for specific coordinate - it asks you to provide this tile. You can use either static tile (see TileProvider) or you can provide URL, so GoogleMap goes to your web server and downloads this tile automatically (see UrlTileProvider)

Don't know is it work for you! But you can share details about your requirements if it's not working. Thanks

Jamil Hasnine Tamim
  • 4,389
  • 27
  • 43
  • 2
    The TS knows how it works, so this information adds no value – Boy Oct 25 '16 at 08:20
  • Nice attitude. It is the Stackoverflow way to moderate. Your 'answer' should be posted as a comment at best. And if you -1 someone, it is courtesy to add a comment why you did this. You just gave general info here. I guess you are the one that gave me a -1 too...quite a professional – Boy Oct 26 '16 at 07:50
  • Sorry I didn't get you! And it's not a argue place about +1/-1!! I just ask you about my minus point nothing else! Leave it.. – Jamil Hasnine Tamim Oct 27 '16 at 05:41