会员
周边
众包
新闻
博问
闪存
赞助商
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
javawebsoa
CnBlogs
Home
New Post
Contact
Admin
C# 处理 google map 经纬度偏移量
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Configuration; namespace WSGPSGateway.BLL { public class LocationLogic { public LocationLogic() { } private static volatile LocationLogic _LocationLogic = new LocationLogic(); /// <summary> /// 得到实例 /// </summary> /// <returns></returns> public static LocationLogic GetInstance() { if (_LocationLogic == null) { lock (typeof(LocationLogic)) { if (_LocationLogic == null) { _LocationLogic = new LocationLogic(); } } } return _LocationLogic; } /// <summary> /// 得到经度和纬度 /// </summary> /// <param name="lat"></param> /// <param name="lng"></param> /// <returns></returns> public decimal[] GetLatLng(decimal lat, decimal lng) { int PX, PY; decimal? PX1, PY1; decimal? OX; decimal? OY; decimal[] LatLng = new decimal[] { lat, lng }; //传入两个参数 ,经度和纬度 ,然后返回经过解析的经度和纬度 try { DAL.DeviceinfoDataSetTableAdapters.deviceinfoAdapter da = new DAL.DeviceinfoDataSetTableAdapters.deviceinfoAdapter(); da.P_GETLATLNG(lat, lng, out OX, out OY); OX = Convert.ToDecimal(OX); OY = Convert.ToDecimal(OY); if (OX != 0 && OY != 0) { Map.LatLongToPixelXY(Convert.ToDouble(lat), Convert.ToDouble(lng), 18, out PX, out PY); PX1 = PX + OX; PY1 = PY + OY; LatLng[0] = Convert.ToDecimal(Map.PixelYToLat(Convert.ToDouble(PY1), 18)); LatLng[1] = Convert.ToDecimal(Map.PixelXToLng(Convert.ToDouble(PX1), 18)); } } catch (Exception ex) { DAL.Log.Write("纠偏处理发生异常! \0 错误记录:" + ex + "\r\n"); DAL.Log.Write("-----------------------------------------------------------\r\n"); } return LatLng; } } }
posted @
2011-04-23 16:26
javawebsoa
Views(
367
) Comments(
0
)
Edit
收藏
举报
刷新页面
返回顶部
公告