Reputation: 23338
I've been using Mapbox GL Native (specifically react-native-mapbox-gl). I'm generating my own vector tiles on a server, and I'd like to have the user download them onto their device from the mobile app. Then I want Mapbox GL to use the local tiles, specified via a TileJSON file referenced in the Mapbox GL Style file.
I've got it working on iOS (at least in the simulator). My style.json
looks like the following:
{
"version":8,
"name":"Bright",
"sources":{
"mapbox":{
"type":"vector",
"url": "asset:///absolute/path/map/tile.json"
}
},
"sprite":"asset:///absolute/path/map/sprites/mysprite",
"glyphs":"asset:///absolute/path/map/glyphs/{fontstack}/{range}.pbf",
"metadata":{...},
"layers":[...]
}
with the tile.json
looking like:
{
"tiles":[
"asset:///absolute/path/map/tiles/{z}/{x}/{y}.pbf"
],
"tilejson":"2.0.0",
// plus lots of other stuff
}
On Android this doesn't work. It appears that asset://
only works on files bundled inside the APK, not on the filesystem.
Is there something I can do on the Android platform to let Mapbox GL load my downloaded tiles from off the device?
Upvotes: 4
Views: 1563
Reputation: 555
Have you tried using the file:/// path? This usually loads from your app's file directory, eg.
"file:///absolute/path/map/tiles/{z}/{x}/{y}.pbf"
Upvotes: 3