腾讯定位 SDK 提供的工具类,提供定位相关的辅助功能。

Author

Tencent Location Team

Since

1.0.3

Constructors

Methods

Constructors

Methods

  • 将 WGS84 坐标系转换为 GCJ-02 坐标系(火星坐标系)。

    Parameters

    • wgsLocation: number[]

      WGS84 坐标,格式为 [latitude, longitude]。

    • gcjLocation: number[]

      GCJ-02 坐标输出数组,格式为 [latitude, longitude]。

    Returns boolean

    转换是否成功,true 表示成功,false 表示失败。

    Example

    const wgs84Location = [39.908722, 116.397499]  // ide 显示有问题, 点击跳转查看
    const gcj02Location = new Array<number>(2)
    const succeed = TencentLocationUtil.wgs84ToGcj02(wgs84Location, gcj02Location)
    if (succeed) {
    console.info('转换成功:', gcj02Location)
    }

    Since

    1.0.3