Mapsui Offline Map

See original GitHub issue

Hi pauldendulk,

first of all i would like to for your amazing job with Mapsui. I succesfully implemented your Mapsui in my project and everything is working fine. But my question is, and the next step in development of my App, is there possibility to load offline Map (is it mbtiles?) in Mapsui? I downloaded my mbtiles and succesfully loaded these mbtiles with “MbTilesTileSource” from Brutile and than created “VectorTileLayer” with this mbtile Source and added this Layer to the map. In Debug is everything fine. Mbtile has been loaded, layer created, datas are there but on the screen I see nothing. Just the white background screen and when I zoom it multiple times it crashes with unhandled exception. Am I doing it right ? Or if not can you give example, sample or anything how to load offline map in Mapsui? Here my code to create layer: public static ILayer CreateTileLayer(string path) { var tileSource = new MbTilesTileSource(new SQLiteConnectionString(path, false), type: MbTilesType.BaseLayer); return new VectorTileLayer(tileSource) { Name = "MbTiles" }; }

Thank you for your time and answer.

Michal

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
pcloofcommented, Jan 19, 2018

You can also get a certain map extent offline programmatically. The basic approach is (in C#):

  1. Obtain a HttpTileSource object (you can cast a TileLayer.TileSource to a HttpTileSource), suppose the object’s name is ‘X’ for now.
  2. Use X.Schema.GetTileInfos(…) to get a list of TileInfo for a given area and zoom level.
  3. Call X.GetTile(…) on each TileInfo obtained in step 2. This gives you the raw bytes of each tile, provided that you have wifi or data enabled.
  4. Store the necessary TileInfo properties and the raw tile data.
  5. You can use the data later when offline. You create a TileProvider based on your tile data, put it in a TileSource and set this as source for your map layer.

Basically you use the same methods that are normally used under the bonnet while zooming and panning a map. Therefore, compatability of the data is self-evident and you don’t need external tools. To use this correctly, you need to know the bounding box of the map area you need and the zoom level you want, so maybe you need some others websites or tools to determine these values in the language that Mapsui expects.

0reactions
pcloofcommented, May 10, 2018

I haven’t been working on my app the last few weeks, so not really paying much attention to github, sorry for that. I use OpenStreetMap and basically get the tile layer with this code (step 1 of my previous post):

using Mapsui.Layers; using Mapsui.Utilities;TileLayer tileLayer = OpenStreetMap.CreateTileLayer(); HttpTileSource tileSource = tileLayer.TileSource as HttpTileSource;

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction
Offline maps are possible using MBTiles implemented with BruTile.MBTiles. This stores map tiles in a sqlite file. Generates static map images to could...
Read more >
unable to load offline map using Mapsui, using world.mbtiles
The Mapsui repository has a working sample that shows the world.mbtiles. You could start from that working sample and work towards your own ......
Read more >
Is there a way to implement an offline map?
Maps uses Google maps and Apple maps for IOS. But they are all online. I want a map that wouldn't have any un...
Read more >
Offline navigation for Xamarin forms? - Microsoft Q&A
I was able to build very basic navigation using Mapsui.Forms (map view) and Itinero (routing). Routing database is already offline however ...
Read more >
An own map with Mapsui - in Xamarin.Forms
Create your own online or offline map for Android, iOS and UWP with Mapsui and Xamarin.Forms.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found