// Copyright 2019 getensh.com. All rights reserved. // Use of this source code is governed by getensh.com. package util import "math" // GeoBaidu2Gaode 将百度转为高德的经纬度坐标 // 输入:百度的纬经度, 纬度lat,经度lon // 输出:高德的纬经度, 纬度,经度 func GeoBaidu2Gaode(lat float64, lon float64) (float64, float64) { PI := 3.14159265358979324 * 3000.0 / 180.0 x := lon - 0.0065 y := lat - 0.006 z := math.Sqrt(x*x+y*y) - 0.00002*math.Sin(y*PI) theta := math.Atan2(y, x) - 0.000003*math.Cos(x*PI) return z * math.Sin(theta), z * math.Cos(theta) }