Behavior of offline tiles with OSM vs Google Maps


I'm catching up on all the great geo changes that have gone into Collect recently. :tada: Previously, offline raster tiles only worked when the mapping engine selected was OpenStreetMaps. Now it's possible to load them with the Google Maps engine which is great. However, the behavior of the two is different. With OSM, all the user sees are the offline tiles (I believe the offline tiles are rendered on top of the online ones but the online ones don't show through). With Google Maps, the offline tiles are displayed on top of the online ones with the online ones also showing.

@zestyping, is this discrepancy due to differing capabilities offered by the two SDKs? Would it be possible for both modes to be supported by both engines?

Or is it perhaps dependent on the nature of the tiles? I used the PNG mbtiles file from here and got the following:



Additional question: what's the behavior for PNG tiles that have transparency? I'm not quickly finding such a tileset to try it.

Here is a tileset with PNGs with transparency around Nepal. They stack on top of the online basemap tiles as expected.

Now that I think about it a bit more, I think what is more likely with the example I showed above is not that anything is showing through with GMaps but rather that labels are rendered on top of all layers.



Yes, I'm pretty sure that's what's happening. The Nepal PNG tiles show up transparently on top of both the Google basemap and the OSM basemap for me. The Google map places and sizes its labels dynamically, so it makes sense to me that the labels would be drawn on top of everything.

I tried this also with the set of example tiles from here (click "Download Example Tiles"), and it's pretty clear the same thing is happening. In OSM mode, I can see the OSM tiles drawn before the MBTiles are drawn on top, and in Google mode, I can see the Google basemap drawn before the MBTiles are drawn on top. The Google labels then appear on top of everything.

1 Like


That makes sense! What do you think about seeing whether those labels can be turned off?

This came up because I was trying a tileset with labels and it was not usable with the Google engine. If they can't be turned off, we should probably make clear in the docs that to use tilesets with labels, the engine needs to be configured to OSM.



Yeah, it makes sense that we would want to turn the labels off when there are offline raster tiles displayed.

I'm fairly confident the labels can be turned off.

The Google Map SDK supports styled maps, and there's a GoogleMap.setMapStyle() method that lets you do pretty extensive styling. The styling example even shows how to turn off landscape labels.

1 Like