如何找到Google Maps Path的长度 [英] How to find the length of Google Maps Path

查看:170
本文介绍了如何找到Google Maps Path的长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用适用于iOS的Google Maps SDK,并使用 GMSMutablePath 对象创建了一个路线。在 API文档中,它说它有一个称为 lengthOfKind 的函数,用于计算路径的长度,但它需要一个 GMSLengthKind

 (CLLocationDistance)lengthOfKind:(GMSLengthKind)kind 
根据种类返回路径的长度。
请参阅GMSLengthKind。

然而,文档中没有提到 GMSLengthKind ,我似乎无法找到任何对输入有意义的东西。有人知道inout应该是什么样的,或者是否有另一种方法来计算路径的长度?



这是我咨询过的链接

  / *在GMSPath.h中定义了  * 
* kGMSEquatorProjectedMeter在以投影单位指定分段的长度时可能会有用。
* kGMSEquatorProjectedMeter的值1 /(pi * EarthRadius)表示在赤道以一米为单位的投影单位长度。例如,要指定在赤道使用100000 * kGMSEquatorProjectedMeter时,对应
*到100km的投影长度。
*参见[GMSPath segmentsForLength:kind:],[GMSPath lengthOfKind:]和kGMSLengthProjected。
* /
extern const double kGMSEquatorProjectedMeter;
$ b $ **
* GMSLengthKind表示长度值的类型,可以是测地线(以米为单位),rhumb
*长度(以米为单位)和投影长度GMSMapPoint单位)。
* /
typedef enum {
/ *
*测地线长度,单位为米,沿测地线段。例如,可能有用的是指定沿着飞机或船舶的轨迹的
*长度。
* /
kGMSLengthGeodesic,

/ *
* Rhumb(直线)线段的长度,以米为单位。例如,可能对
*在地图上绘制比例尺有用。一段给定长度的视觉大小取决于
*纬度。
* /
kGMSLengthRhumb,

/ *
*投影空间的长度,沿着各个分段。预计长度使用与
*相同的单位* GMSMapPoint - 地球赤道周长长度为2.可以指定预计的
*长度,单位对应赤道1米,乘以
* kGMSEquatorProjectedMeter,等于1 /(pi * EarthRadius)。
*
*预计长度可能很有用,例如,指定具有相同视觉长度
*的段,而不考虑纬度。
* /
kGMSLengthProjected
} GMSLengthKind;


I'm using the Google Maps SDK for iOS and have created a route using the GMSMutablePath object. In the API Documentation, it says it has a function called lengthOfKind that calculates the length of the path, but it requires an object of type GMSLengthKind.

(CLLocationDistance) lengthOfKind:      (GMSLengthKind)     kind    
Returns the length of the path, according to kind.  
See GMSLengthKind.

However, there is nowhere in the documentation that mentions a GMSLengthKind and I can't seem to find anything that would make sense for the input. Does anyone know what the inout should be or if there is another way to calculate the length of the path?

This is the link which I have consult

解决方案

GMSLengthKind is defined in GMSPath.h:

/**
 * kGMSEquatorProjectedMeter may be useful when specifying lengths for segment in "projected" units.
 * The value of kGMSEquatorProjectedMeter, 1/(pi * EarthRadius), represents the length of one meter
 * at the equator in projected units. For example to specify a projected length that corresponds
 * to 100km at the equator use 100000 * kGMSEquatorProjectedMeter.
 * See [GMSPath segmentsForLength:kind:], [GMSPath lengthOfKind:] and kGMSLengthProjected.
 */
extern const double kGMSEquatorProjectedMeter;

/**
 * GMSLengthKind indicates the type of a length value, which can be geodesic (in meters), rhumb
 * length (in meters) and projected length (in GMSMapPoint units).
 */
typedef enum {
  /*
   * Geodesic length, in meters, along geodesic segments. May be useful, for example, to specify
   * lengths along the the trajectory of airplanes or ships.
   */
  kGMSLengthGeodesic,

  /*
   * Rhumb length, in meters, along rhumb (straight line) segments. May be useful, for example, to
   * draw a scale bar on a map. The visual size of a segment of a given length depens on the
   * latitude.
   */
  kGMSLengthRhumb,

  /*
   * Length in projected space, along rhumb segments. Projected length uses the same units as
   * GMSMapPoint - the Earth equator circumference has length 2. It is possible to specify projected
   * length in units corresponding to 1 meter at the equator by multiplying with
   * kGMSEquatorProjectedMeter, equal to 1/(pi * EarthRadius).
   *
   * Projected length may be useful, for example, to specify segments with the same visual length
   * regardless of latitude.
   */
  kGMSLengthProjected
} GMSLengthKind;

这篇关于如何找到Google Maps Path的长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆