Comments (7)
Felix, thanks for the issue. Have you found a solution for MBTiles? If so it would be great if you could share your approach here. I'm not sure if you meant to close this issue.
from flutter-vector-map-tiles.
Hi, ive had the same issue with loading offline vector tiles from a mbtiles file, and just figured out a working method which i wanted to share:
So, mbtiles are basically a sqlite database which holds the tiles as gzipped pbf blob data.
You can create your own VectorTileProvider which converts the TileIdentity xyz adress into a SQL Statement like this:
"SELECT tile_data FROM tiles WHERE zoom_level = ${tile.z} AND tile_column = ${tile.x} AND tile_row = $y"
As noted in the MBTiles spec, you have to flip the y axis like this:
int y=(pow(2,z)-1-tile.y).toInt();
Note that in the TMS tiling scheme, the Y axis is reversed from the "XYZ" coordinate system commonly used in the URLs to request individual tiles, so the tile commonly referred to as 11/327/791 is inserted as zoom_level 11, tile_column 327, and tile_row 1256, since 1256 is 2^11 - 1 - 791.
Query the mbtiles file and gzip.decode the resulting blob to get the raw pbf vector data
Keep in mind that these pbf tiles are still written to disk by the parent VectorTileProvider (like any network-based provider) and wont be used directly from memory
from flutter-vector-map-tiles.
Thank you so much @goritz for the detailed explanation, much appreciated! We will give it a try these coming weeks and contribute to the source here.
Stumbled across this repo also, where a first stab was made at this approach. Will review and revert back.
Got a feeling that this will be quite the popular feature for this plugin :-)
from flutter-vector-map-tiles.
Thanks for the issue! Sorry, but MBTiles are not supported.
It would help to understand your use-case. What do you want to achieve with MBTiles?
from flutter-vector-map-tiles.
We are currently using MBTiles to provide OSM maps of different regions offline for our users.
I found the following package MBTilesImageProvider. But this is only suitable for MBTiles that contain png data. However, I managed to modify the code so that it now also works with vector maps. If you like I can create a PR for the MBTilesVectorProvider.
from flutter-vector-map-tiles.
We are currently using MBTiles to provide OSM maps of different regions offline for our users.
I found the following package MBTilesImageProvider. But this is only suitable for MBTiles that contain png data. However, I managed to modify the code so that it now also works with vector maps. If you like I can create a PR for the MBTilesVectorProvider.
Hi @felixjunghans, would you care to shed some light on how you got vector tiles from MBtiles working?
from flutter-vector-map-tiles.
Hi @felixjunghans - like Leevi, we're also looking into figuring out offline storage for map segments, either via MBTILES or MVT. Which way did you end up going with your offline vector tile solution?
from flutter-vector-map-tiles.
Related Issues (20)
- Not accepting map styles from other sources HOT 1
- Differences in Styles for Mapbox.
- Update flutter_map dependency to 6.1.x HOT 4
- Web support HOT 1
- Question about working with tile server.
- [StyleReader] Converting JSON into a Style HOT 4
- DEpendency problems when upgrading to 6.0.2 HOT 2
- display with rotation is not the same between vector and raster modes in version 7.0.0 HOT 3
- is expressmaps supported? HOT 1
- Package available for web? HOT 2
- Raster Tiles Usage HOT 1
- would something like https://github.com/fleaflet/flutter_map_cancellable_tile_provider help in performance HOT 1
- very low performance HOT 1
- Override background color of VectorTileLayer HOT 1
- Google maps support - Issue HOT 3
- Can't display pg_tileserv and postgis tiles HOT 1
- How to rotate and zoom the map like a native map experience
- Raster mode tile cancellation HOT 1
- new version available
- providers.isNotEmpty error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter-vector-map-tiles.