Mapsui: Creating MbTilesTileSource() is slow - worst on device (Xamarin.Forms)
Hi there, sorry that I keep bugging you guys - you do an incredible job, thanks!
I am using mbtiles for my map data, which I generate by using Maperative on Windows.
I see that when I start creating more and more “complex” (meaning bigger) maps, it really starts hurting the performance.
Creating the MbTilesTileSource takes 35 seconds on a physical iPhone XS Max. If I do the same on the simulator on my iMac, the same only takes 5 seconds :
var mbTilesTileSource = new MbTilesTileSource(new SQLiteConnectionString(path, true));
The mapfile is 537 mb, but being a SQLite database I do not expect size to be the biggest issue.
It also seems like the map becomes more “laggy”, when adding more tiles. But, I thought that by only loading the tiles “visible”, it would not matter if it is a huge or small map - or have I misunderstood something ?
Has anyone tried the same size mbtiles map data files and experience the same ?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (16 by maintainers)
So I have looked a bit into the BruTile sourcecode, to see how to optimize my issues described above!
Its actually the code that scans the mbtiles database to create the extent, as you wrote. Thanks for the pointer!
I created a fix that “caches” the data inside the metadata table, so the next time the mbtiles file is being loaded - its being read from there instead of scanning the database.
But despite this, the best “fix” is to call the constructor with all the necessary information:
With the above code, my loading of the map has almost no delay.
It now takes 400 ms to initialize the map on my device (was 40+ seconds before), add mbtiles, add routes and POI’s - thats crazy fast!