💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
>[info] 百度高德地图坐标转换 ~~~ /** * 百度地图坐标转高德地图坐标 * @param point 坐标 * @returns {{lng: number, lat: number}} */ export function bd09ToGcj02(point) { const x_pi = (3.14159265358979324 * 3000.0) / 180.0; const x = point.lng - 0.0065, y = point.lat - 0.006; const z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi); const theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi); return { lng: z * Math.cos(theta), lat: z * Math.sin(theta) }; } /** * 高德地图坐标转百度地图坐标 * @param point 坐标 * @returns {{lng: number, lat: number}} */ export function gcj02ToBd09(point) { const x_pi = (3.14159265358979324 * 3000.0) / 180.0; const x = point.lng, y = point.lat; const z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi); const theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi); return { lng: z * Math.cos(theta) + 0.0065, lat: z * Math.sin(theta) + 0.006 }; } ~~~