zoukankan
html css js c++ java
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; } } }
查看全文
相关阅读:
Leetcode: K-th Smallest in Lexicographical Order
Leetcode: Minimum Number of Arrows to Burst Balloons
Leetcode: Minimum Moves to Equal Array Elements
Leetcode: Number of Boomerangs
Leetcode: Arranging Coins
Leetcode: Path Sum III
Leetcode: All O`one Data Structure
Leetcode: Find Right Interval
Leetcode: Non-overlapping Intervals
Socket网络编程--简单Web服务器(3)
原文地址:https://www.cnblogs.com/javawebsoa/p/2458199.html
最新文章
Leetcode: Nested List Weight Sum II
Leetcode: Nested List Weight Sum
Leetcode: Largest BST Subtree
Leetcode: Wiggle Sort II
Leetcode: Sort Characters By Frequency
Leetcode: Delete Node in a BST
Leetcode: Add Two Numbers II
2Sigma OA prepare: Longest Chain
2Sigma OA prepare: Friends Circle
Leetcode: Find All Numbers Disappeared in an Array
热门文章
Leetcode: Find All Duplicates in an Array
Leetcode: Minimum Genetic Mutation
Leetcode: Island Perimeter
Leetcode: Can I Win
Leetcode: Repeated Substring Pattern
Leetcode: Assign Cookies
Leetcode: 132 Pattern
Leetcode: Arithmetic Slices II
Leetcode: Minimum Moves to Equal Array Elements II
Leetcode: 4Sum II
Copyright © 2011-2022 走看看