iOS6中用于获取gps位置静态地图图像的任何api
我想从一个位置的静态地图图像。我有那个位置的经纬度。iOS 6中是否有任何api来获取gps位置的apple map静态图像。只需使用MKMapView来显示地图,就必须使用MapKit.framework 此链接将帮助您iOS6中用于获取gps位置静态地图图像的任何api,ios,image,ios6,maps,Ios,Image,Ios6,Maps,我想从一个位置的静态地图图像。我有那个位置的经纬度。iOS 6中是否有任何api来获取gps位置的apple map静态图像。只需使用MKMapView来显示地图,就必须使用MapKit.framework 此链接将帮助您 快乐编码 MKMapView有两个属性来实现此功能:scrollEnabled和zoomEnabled。将两者都设置为NO,您将拥有一个非滚动和非缩放(因此是静态的)地图图像。我相信这就是您要寻找的。将位置参数发送给它,它将返回您想要的图像。在iOS 7+上,Apple M
快乐编码 MKMapView有两个属性来实现此功能:
scrollEnabled
和zoomEnabled
。将两者都设置为NO
,您将拥有一个非滚动和非缩放(因此是静态的)地图图像。我相信这就是您要寻找的。将位置参数发送给它,它将返回您想要的图像。在iOS 7+上,Apple MapKit允许使用类显示地图的静态图像。有关详细信息,请参见MapKit文档的第节:
// Takes a snapshot and calls back with the generated UIImage
static func takeSnapshot(mapView: MKMapView, withCallback: (UIImage?, NSError?) -> ()) {
let options = MKMapSnapshotOptions()
options.region = mapView.region
options.size = mapView.frame.size
options.scale = UIScreen.mainScreen().scale
let snapshotter = MKMapSnapshotter(options: options)
snapshotter.startWithCompletionHandler() { snapshot, error in
guard snapshot != nil else {
withCallback(nil, error)
return
}
withCallback(snapshot!.image, nil)
}
}
谢谢你的回复。我需要一张地图在某个位置的静态图像。这也是我实现这一点的方法。别忘了
pitchEnabled
和rotateEnabled
。@Dr Mickeylauer:我建议了一个替代方案,有什么问题吗?谷歌静态地图提供了很多选择和更好的地图。