aah134
aah134

Reputation: 860

How to use OSM offline maps in uwp? Issue when no internet connection available

with offline mapping working well, all bitmap of OSM coming from a localhost server on the same machine. all well and can see all my maps however if the wifi is not connected to the internet, the map completely stop working showing a black screen"

I have tested the server when wifi is off and seemed to bring the correct map tile in browser.

I get the map using HttpMapTileDataSource pointing at a local node tile server

            var serverUrl = string.Format("http://127.0.0.1:6543/{0}", newTileInfo.TileUri);
            var url = string.Format("{0}/{{zoomlevel}}/{{x}}/{{y}}.png", serverUrl);
            HttpMapTileDataSource dataSource = new HttpMapTileDataSource(url);

            MapTileSource tileSource = new MapTileSource(dataSource);
            tileSource.AllowOverstretch = true;
            tileSource.IsFadingEnabled = false;

            _zoom = newTileInfo.Range;

            MapControl1.TileSources.Add(tileSource);

after seeing this issue, I am guessing offline map is possible with a permission to use the map control (have to be online which defeat the offline mapping intention)

Upvotes: 0

Views: 604

Answers (1)

Sunteen Wu
Sunteen Wu

Reputation: 10627

For HttpMapTileDataSource, note that, as of build 15063, local uris don't work anymore. As you are connecting to 127.0.0.1 which is the local server, so that you may need to use a CustomMapTileDataSource instead. For each requested tile the event handler BitmapRequested is called. In this handler you can pass any bitmap to the map.

More details please reference Overlay tiled images on a map.

Upvotes: 1

Related Questions