我们正在使用MapBox SDK开发用于脱机地图的iOS移动应用程序。
我们目前面临iOS MapBox SDK的两个主要问题。
我们能够成功下载地图。该应用程序适用于小区域地图,但是如果我们下载大型离线区域/数据包,则相同的代码将花费太多时间来加载大地图。特别适用于大小超过2GB的Mapbox卫星街道地图。但这不是在Android中发生。
由于离线地图太大,因此,如果我们尝试删除离线数据包,则可能会花费太多时间,并且由于图块数量超出限制,因此无法下载更多地图。
< / li>您能否指导我们如何使此应用程序更好地与iOS中的离线地图配合使用?
我们遵循了MapBox SDK提供的所有iOS文档,但是在大型离线打包的情况下无法调整性能。
用于在iOS中加载脱机包的源代码。
if (packs.count) > 0{
for i in 0..<(packs.count){
let dict = NSKeyedUnarchiver.unarchiveObject(with: packs[i].context ) as! [String: Any]
if (map.mapGenID) == "\(dict["mapID"]!)" {
index = i
break
}
}
if let tiles = MGLOfflineStorage.shared.packs?[index].region as? MGLTilePyramidOfflineRegion{
if let currentStyle = SharedMapView.shared().mapView.styleURL {
if !currentStyle.absoluteString.isEqual(tiles.styleURL.absoluteString) {
SharedMapView.shared().mapView.styleURL = tiles.styleURL
SVProgressHUD.show(withStatus: "Loading Map ..")
}
}else{
SharedMapView.shared().mapView.styleURL = tiles.styleURL
}
offlineMapBounds = tiles.bounds
SharedMapView.shared().mapView.minimumZoomLevel = tiles.minimumZoomLevel
SharedMapView.shared().mapView.maximumZoomLevel = tiles.maximumZoomLevel
SharedMapView.shared().mapView.setVisibleCoordinateBounds(offlineMapBounds, edgePadding: UIEdgeInsets(top: 12, left: 12, bottom: 12, right: 12), animated: true)
}
}
用于删除脱机包的源代码。
MGLOfflineStorage.shared.removePack(self.packs[indexPath.row], withCompletionHandler: { (err) in
if (err == nil) { //Pack Deleted
// Delete from Table row
}
})
我们希望快速加载大型离线地图,因为它可以与小型地图完美配合。