Handling offline maps by loading mbtiles extracted files in a directory structure is not desired because of the increment in application size. A feature to load mbtiles directly will be propper handling of offline maps.
Also, current mbtiles no longer contain png images, instead they contain compressed protocol buffer tile information, loading mbtiles with this format would reduce significantly space requirements.
I had thought of this when I created the offline maps function. I had actually implemented this function in a test branch in my fork.
mbtiles is a SQLite database that holds the images. My implementation opened the sqlite database and called it using the network image feed. However, performance hit was taken and I had concluded it not to be a worthy effort to pursuit.
Not all mbtiles holds images, some of them, or really, most of them contains vectorial tile representation. Nevertheless, the benefit of using mbtiles is that space required is significantly lower, for example, the possibility of lading tiles from a directory with images is implemented, but mbtiles reduces the asset space by not repeating tiles, for example for the water. You are welcome to try an example, but directory with tiles can be 10x bigger in space than the associated mbtiles, and loading that amount of information to the app, and even reading it from disk can have worst performance.
I guess we'll have to wait until vectors are supported!
On android we ran into the issue that the build process cant handle 11.000 map tiles (https://github.com/flutter/flutter/issues/20316). A SQLite database could fix this.
I think this is stale - loading from .mbtiles is supported AFAICT.
@johnpryan loading from .mbtiles is not supported, converting the mbtiles to a series of png and loading those png is not support for mbtiles, as I said in the issue post.
Perhaps what you want to say is that mbitles support is not intended to be added.
I'm not sure I understand. What do you mean by "converting the mbtiles into a series of png"? Is there something incorrect with the current mbtiles example?
@johnpryan from the project readme:
Once you have your map exported to .mbtiles, you can use mbtilesToPng to unpack into /{z}/{x}/{y}.png. Move this to Assets folder and add asset directories to pubspec.yaml. Minimum required fields for offline maps are:
Have you tried the MBTilesImageProvider API?
Have you tried the
MBTilesImageProviderAPI?
No, where is it and where do I found it? Is from another plugin? Is documented somewhere? Is there any example using it somewhere in the project?
Perhaps that is what you should have said before closing the issue.
You're right, we can improve the docs here.
Have you tried the
MBTilesImageProviderAPI?No, where is it and where do I found it? Is from another plugin? Is documented somewhere? Is there any example using it somewhere in the project?
Perhaps that is what you should have said before closing the issue.
For example:
TileLayerOptions(
maxZoom: 20,
backgroundColor: Colors.transparent,
tileProvider: MBTilesImageProvider.fromAsset('assets/sokolniki.mbtiles'),
tms: true,
),
Do not forget set tms: true
Have you tried the
MBTilesImageProviderAPI?No, where is it and where do I found it? Is from another plugin? Is documented somewhere? Is there any example using it somewhere in the project?
Perhaps that is what you should have said before closing the issue.For example:
TileLayerOptions( maxZoom: 20, backgroundColor: Colors.transparent, tileProvider: MBTilesImageProvider.fromAsset('assets/sokolniki.mbtiles'), tms: true, ),Do not forget set tms: true
I have used this and my map is showing up as blank without no errors being printed.
Have you tried the
MBTilesImageProviderAPI?No, where is it and where do I found it? Is from another plugin? Is documented somewhere? Is there any example using it somewhere in the project?
Perhaps that is what you should have said before closing the issue.For example:
TileLayerOptions( maxZoom: 20, backgroundColor: Colors.transparent, tileProvider: MBTilesImageProvider.fromAsset('assets/sokolniki.mbtiles'), tms: true, ),Do not forget set tms: true
I have used this and my map is showing up as blank without no errors being printed.
Are you using raster MBTiles? Vector MBTiles is not supported.
Any Plans to support Vector MBTiles?
I dabbled a bit with vector tiles at https://github.com/ibrierley/flutter_map_vector_tiles which may be of some use if anyone fancies a stab at it. I'm not aware of any fully functioning support out there. I may be willing to revisit it, if there were other people who wanted to contribute as well, but last time I tested, it was difficult to get good performance on pinch/zoom if that's a requirement (it may just have been my coding though :)).
Most helpful comment
I dabbled a bit with vector tiles at https://github.com/ibrierley/flutter_map_vector_tiles which may be of some use if anyone fancies a stab at it. I'm not aware of any fully functioning support out there. I may be willing to revisit it, if there were other people who wanted to contribute as well, but last time I tested, it was difficult to get good performance on pinch/zoom if that's a requirement (it may just have been my coding though :)).