Reputation: 2431
I want to make offline map applications using mapbox iOS/Android SDK.
But, I load style from local filesystem, like below: (Sorry, I'm Xamarin user, so write in c#)
var bundlePath = NSBundle.MainBundle.BundlePath;
var filePath = Path.Combine(bundlePath, "gsimaps.json");
var styleURL = NSUrl.CreateFileUrl (filePath, null);
var mapView = new MapView (Bounds, styleURL);
Then error shows:
[ERROR] {Map}[Setup]: loading style failed: response class is not NSHTTPURLResponse
Are there any way to load styles from local data? From file, from DB, from memory, any means are OK, I want to know the way to use local data.
And also, are there any ways to use local raster tile in MapBox SDK? (From file, DB, or memory..)
Upvotes: 1
Views: 1418
Reputation: 60963
In Android,
First, declare a map_style.json
inside assets folder
Then in Java code
mapView.setStyleUrl("asset://map_style.json");
Upvotes: 1
Reputation: 2431
MapBox have a plan to implement local interface:
https://github.com/mapbox/mapbox-gl-native/issues/7471
Upvotes: 0
Reputation: 3964
You should take a look at my github project (Tiles for Android/iOS/UWP) but I have a problem with the updating of these tiles -> Double update for tiles..
Upvotes: 0