WhirlyGlobe
WhirlyGlobe copied to clipboard
changeTileInfo seems not to work
I was trying to change the mbtiles - file in runtime using
func changeTileInfo(_ tileInfo: [MaplyTileInfoNew](doc://com.apple.documentation/vqwg3q?language=swift&usr=true))
but it seems to me that nothing happens. In the simulator changeTileInfo leads to a crash, in the real iPad it runs without complaining, but it does nothing.
let standardTilesFetcherED = MaplyMBTileFetcher(mbTiles: "satellite-lowres-v1.2-z0-z5")
let imageLoaderED = MaplyQuadImageLoader(params: sampleParams, tileInfo: standardTilesFetcherED!.tileInfo(), viewC: tmpViewC!)
let streetTilesFetcherED = MaplyMBTileFetcher(mbTiles:"OAM-World-1-10-J70.mbtiles")
if let s = standardTilesFetcherED { self.imageLoaderED!.changeTileInfo(s.tileInfo()!) }
If changeTileInfo is not meant to change a running tileset, what would be the correct way? For example you want to change the existing map with its zoom level and everything else to a different mbtiles file, like changing a Apple Map from Satellite to Streetmap? This is what the documentation says about changeTileInfo :
Change the tile source and reload all the data. You can change the tile source data is being loaded from. This will force a reload and everything visual should change as the data comes in.
The structure of the sources has to match exactly. Same zoom level and such. Setting up loaders is pretty fast. I'd just recommend doing a new one.