Raster Tiles aren't saved via OfflineManager
See original GitHub issueEnvironment
- Mapbox (GL) implementation: v10
- Mapbox (GL) version: 10.7.0
- @rnmapbox/maps Version #main
- Platform: iOS
- React Native Version 0.68
- Platform OS: iOS 15
- Device: any
- Emulator/ Simulator: yes
- Dev OS: Monterey
Standalone component to reproduce
import React from 'react';
import {StyleSheet, View} from 'react-native';
import MapboxGL from '@rnmapbox/maps';
const styles = StyleSheet.create({
mapView: {flex: 1},
});
class BugExample extends React.Component {
constructor(props) {
super(props);
this.state = {
showMap: false, // change to true to show map
};
}
async componentDidMount() {
// delete for testing
// console.log(await MapboxGL.offlineManager.deletePack('field-1'));
console.log('>>>>>>>>>>start creating pack', );
await MapboxGL.offlineManager.createPack(
{
name: 'field-1', // any
bounds: [[32.23782523101579, 46.39912398458027], [33.43887899585923, 47.041693870480955]], // any LARGE area
styleURL: MapboxGL.StyleURL.Satellite,
minZoom: 10,
maxZoom: 12,
},
(pack, status) => {
console.log('>>>>>>>>>>pack progress', pack.name, status.percentage, status.completedTileCount);
},
(pack, error) => {
console.log('>>>>>>>>>>pack error', pack.name, error);
},
);
console.log(await MapboxGL.offlineManager.getPacks());
}
render() {
// change showMap to true to render map when offline (wifi off / airplane mode) to test offline loading of tiles
if (!this.state.showMap) return <View />;
return (
<View style={styles.mapView}>
<MapboxGL.MapView
ref={(c) => (this._map = c)}
onPress={this.onPress}
style={styles.mapView}
styleURL={MapboxGL.StyleURL.Satellite}
>
<MapboxGL.Camera
zoomLevel={10}
centerCoordinate={[33.43887899585923, 47.041693870480955]}
/>
</MapboxGL.MapView>
</View>
);
}
}
export default BugExample;
}
Observed behavior and steps to reproduce
Any raster style (eg; Satellite or SatelliteStreet) is able to be downloaded successfully; however, when loaded offline the raster images aren’t rendered. The vector assets are rendered successfully (streets, city names, etc). The rest of the map is blurry as it is unable to load the raster images.
- start sample app & wait until download is complete
- go offline
- flip
state.showMap
to true - Map is rendered without raster tiles and only shows vector assets
Expected behavior
Raster tiles should be rendered when offline.
Notes / preliminary analysis
The map pack is created successfully for a raster style; however, it doesn’t seem like the raster assets are actually downloaded.
EDIT: It appears the iOS code is outdated and the zoom range needs to be passed in the TilesetDescriptorOptions. Android appears to still be broken however.
Additional links and references
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Satellite Styles don't work on an Offline map #1460 - GitHub
When using the offline map functionality with Satellite or Satellite Streets styles, the rasterised tiles appears as black squares.
Read more >OfflineManager - Mapbox docs
Merge offline regions from a secondary database into the main offline database. When the merge is completed, or fails, the OfflineManager.
Read more >Raster tiles from geoserver (offline) - GIS Stack Exchange
I fear that mapping png files in the GWC tree to Google tile names is not trivial. The subdirectories in the GWC tree...
Read more >Using Mapbox GL Offline - Stack Overflow
Show activity on this post. I basically just run a webserver within the iOS app and serve the tiles. Works for vector and...
Read more >Take a map offline—ArcGIS Pro | Documentation
When a network connection is not available, you can edit the downloaded feature data using information in the offline tile packages for reference....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mfazekas should we leave this open as it’s still broken for Android?
@maclne ah thank you!
It appears the rnmapbox ios code is out of date and using
minZoom
andmaxZoom
instead ofzoomRange
for the TilesetDescriptorOptions which is specified in the latest ios mapbox docs: https://docs.mapbox.com/ios/maps/api/10.7.0/Extensions/TilesetDescriptorOptions.html#/s:So27MBMTilesetDescriptorOptionsC10MapboxMapsE8styleURI9zoomRange10pixelRatio0f4PackC0AbC05StyleG0V_SNys5UInt8VGSfSo08MBMStylel4LoadC0CSgtcfcI tested on iOS and it works perfectly! I’ll submit a PR later this evening.
I’m still unsure about how to implement for Android though.