Ios 在没有卫星图层的情况下,如何在Mapbox中下载MGLTilePyramidOfflineRegion?
我正在使用MapBox下载脱机地图。因此,用户可以在没有互联网连接的情况下访问特定区域 当我尝试下载一个区域时,我的问题出现了,并且该样式具有卫星层,这一层有很多我不想要的资源。此问题仅出现在带有卫星层的地图上,而不出现没有此层的地图。是否可以下载没有“卫星”层的区域 目前,我正在使用此功能下载某个区域周围的区域Ios 在没有卫星图层的情况下,如何在Mapbox中下载MGLTilePyramidOfflineRegion?,ios,dictionary,mapbox,mapbox-ios,mapbox-ios-maps,Ios,Dictionary,Mapbox,Mapbox Ios,Mapbox Ios Maps,我正在使用MapBox下载脱机地图。因此,用户可以在没有互联网连接的情况下访问特定区域 当我尝试下载一个区域时,我的问题出现了,并且该样式具有卫星层,这一层有很多我不想要的资源。此问题仅出现在带有卫星层的地图上,而不出现没有此层的地图。是否可以下载没有“卫星”层的区域 目前,我正在使用此功能下载某个区域周围的区域 func downloadMapRegionInBackground( mapView: MGLMapView, radius: Double, coordin
func downloadMapRegionInBackground(
mapView: MGLMapView,
radius: Double,
coordinate: CLLocationCoordinate2D
) {
let region = MGLTilePyramidOfflineRegion(
styleURL: mapView.styleURL,
bounds: mapView.visibleCoordinateBounds,
fromZoomLevel: mapView.zoomLevel,
toZoomLevel: mapView.maximumZoomLevel
)
let userInfo = ["name": "\(region.bounds)"]
let context = NSKeyedArchiver.archivedData(withRootObject: userInfo)
MGLOfflineStorage.shared.addPack(for: region, withContext: context) { [weak self] pack, _ in
guard pack != nil else {
self?.notificationsService.failure(
withTitle: nil,
message: L10n.Map.OfflineRegion.failed
)
return
}
pack?.resume()
self?.notificationsService.information(
withTitle: nil,
message: L10n.Map.OfflineRegion.started
)
}
}