4

如何计算我的地图视图中心(不是用户当前位置)的海拔(海平面的高度),以米为单位?

例如,我们可以在 Google Earth 上看到这个指示:

谷歌地球图片

4

3 回答 3

3

关于什么

mapView.camera.altitude

@property(nonatomic) CLLocationDistance 高度

地面以上的高度,以米为单位。

可用性 iOS(7.0 及更高版本)

在 MKMapCamera.h 参考中声明 MKMapCamera 类参考

于 2014-11-13T14:47:23.370 回答
2

As far as I know Apple does not provide an API for determining the altitude of a coordinate. Google has an Elevation API that can be used for this. You can access it through an HTTP interface and get the altitude of a location as an JSON response.

Issue the following request to get the elevation of 39.7391536,-104.9847034:

http://maps.googleapis.com/maps/api/elevation/json?locations=39.7391536,-104.9847034&sensor=false

Then you'll get a JSON response like this

{
   "results" : [
      {
         "elevation" : 1608.637939453125,
         "location" : {
            "lat" : 39.73915360,
            "lng" : -104.98470340
         },
         "resolution" : 4.771975994110107
      }
   ],
   "status" : "OK"
}

The full Elevation API is documented here https://developers.google.com/maps/documentation/elevation/

于 2013-09-22T23:25:29.060 回答
1

CLLocation带有当前位置的高度

于 2013-05-24T10:39:17.090 回答