Comments (3)
Hi @pepobit For now the offline function is only supported in iOS.
To download a map style:
var offlineService = DependencyService.Get<Naxam.Controls.Mapbox.Forms.IOfflineStorageService>();
var region = new OfflinePackRegion()
{
StyleURL = "<your map style url here>",
MaximumZoomLevel = 14,
MinimumZoomLevel = 1,
Bounds = new CoordinateBounds()
{
NorthEast = new Position()
{
Lat = 55.800,
Long = 9.000
},
SouthWest = new Position()
{
Lat = 55.650,
Long = 8.700
}
}
};
offlineService.DownloadMap(region, new System.Collections.Generic.Dictionary<string, string>() {
{"name", "test"}
});
To observe download progress:
offlineService.OfflinePackProgressChanged += (sender, e) => {
var progress = e.OfflinePack.Progress;
float percentage = 0;
if (progress.CountOfResourcesExpected > 0)
{
percentage = (float)progress.CountOfResourcesCompleted / progress.CountOfResourcesExpected;
}
System.Diagnostics.Debug.WriteLine($"Downloaded resources: {progress.CountOfResourcesCompleted} ({percentage * 100} %)");
System.Diagnostics.Debug.WriteLine($"Downloaded tiles: {progress.CountOfTilesCompleted}");
if (progress.CountOfResourcesExpected == progress.CountOfResourcesCompleted) {
System.Diagnostics.Debug.WriteLine("Download completed");
}
};
To get offline packs:
OfflinePack[] packs = await offlineService.GetPacks();
The first time you get packs, the packs' states may not be correct, since "The state and progress of an inactive or completed pack are computed lazily". So you'll need to call void RequestPackProgress(OfflinePack pack)
to observe the packs' states.
For more information please read MapBox's documents about Offline maps and MGLOfflinePack
from mapbox-xamarin-forms.
@pepobit I am going to close this issue due to no response from you. If you still get issue, plz reopen.
from mapbox-xamarin-forms.
offline map not working in android
from mapbox-xamarin-forms.
Related Issues (20)
- user location issue HOT 1
- Center offset
- Implement Get Cluster Leaves
- Need to show marker with Label/Text
- Outdated
- Android: app freeze + fix
- Navigation
- Symbol Annotations not getting refreshed in run time
- Release mode iOS fails
- Can't Run Xamarin.Forms App on Android HOT 12
- map property global
- App Crash on Android 11 HOT 5
- Demo project from repo doesn't compile HOT 4
- App Crash on Android 11 HOT 2
- Mapbox Xamarin.Forms black map on Android HOT 1
- MapView.ZoomLevel does not change on iOS.
- MapBox pre-v10 is unsupported from April 4th 2023 HOT 3
- Showing CircleAnnotations on map
- Unable to activate instance of type Naxam.Controls.Mapbox.Platform.Droid.MapViewRenderer from native handle HOT 2
- Map Bounds Are Not Properly Set To Query Map Features HOT 1
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 mapbox-xamarin-forms.