public Point Translate(double lat, double lng, bool address = false) { Point gps; if (lat == -1.0 && lat == -1.0) { gps = new Point(-1.000, -1.000); gps.Address = "未解析到地址."; return(gps); } gps = PositionUtil.gps84_To_Gcj02(lat, lat); try { if (address) { gps.Address = GetAddress(gps); } return(gps); } catch (Exception) { gps.Address = "未知"; return(gps); } }
/// <summary> /// Google中国用的是GCJ02坐标系,Google国外用的是WGS84坐标系 /// </summary> /// <param name="lat"></param> /// <param name="lng"></param> /// <param name="address"></param> /// <returns></returns> public Point Translate(double lat, double lng, bool address = false) { //国内转成 Gcj02 if (PositionUtil.outOfChina(lat, lng)) { return(PositionUtil.gps84_To_Gcj02(lat, lng)); } //国外直接返回 return(new Point(lat, lng)); }