14 lines
340 B
JavaScript
14 lines
340 B
JavaScript
|
const util = require('./WSCoordinate.js')
|
||
|
|
||
|
export const wgsToGcj = (data)=>{
|
||
|
try{
|
||
|
let d = data;
|
||
|
//将WGS-84(国际标准)转为GCJ-02(火星坐标)
|
||
|
let e = util.transformFromWGSToGCJ(data.latitude, data.longitude);
|
||
|
d.latitude = e.latitude;
|
||
|
d.longitude = e.longitude;
|
||
|
return d;
|
||
|
}catch(e){
|
||
|
return data;
|
||
|
}
|
||
|
}
|