使用JS将GPRMC转换成WGS84/GCJ02
背景 Background
在物联网相关的 应用中,我们经常都要将使用BG96的设备的GPS定位数据定位到Google Map中。
我们要将其GPRMC的数据转换成WGS84或GCJ02
In IoT system, we often get the GPS data from the device using BG96
We have to convert the raw data to WGS84/GCJ02 to show the device location on GoogleMap.
代码 Code
GPRMC 转换成WGS84
// The GPRMC gps data: 2259.312015N,11355.933779E
// @return 22.988533583333332 113.93222965
setLatLng(v) {
let vArr = v.split(',');
let lat, lng;
for (let i = 0; i < vArr.length; i++) {
if (i == 0) {
if (vArr[i].substring(vArr[i]