Пример #1
0
        public List<string> GetPositions(LatLon[] array) 
        {
            List<string> lsLocation = new List<string>();
            try
            {
                var mapService = new PES.GPS.MapService.MapSearchService.MapService();
                IList<LocationInfo> list = mapService.InverseGeocoding(array);
                if (list.Count == 0)
                {
                    Logger.Error(string.Format("PositionService.GetPositions(LatLon[] array)获取位置失败"));
                }
                else
                {
                    for (int i = 0; i < list.Count;i++ )
                    {
                        lsLocation.Add(list[i].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error(string.Format("PositionService.GetPositions(LatLon[] array)获取位置失败,error:{0}", ex.Message), ex);
            }

            return lsLocation;            
        }
Пример #2
0
 public IList<LocationInfo> GetPosition(IList<LatLon> ltLatLon)
 {
     try
     {
         var mapService = new PES.GPS.MapService.MapSearchService.MapService();
         return mapService.InverseGeocoding(ltLatLon.ToArray());
     }
     catch (Exception ex)
     {
         Logger.Error(string.Format("PositionService.GetPosition(IList<LatLon> ltLatLon)获取位置失败,error:{0}", ex.Message), ex);
         return new List<LocationInfo>();
     }
 }
Пример #3
0
        public string GetPosition(string latlon)
        {
            string position = string.Empty;
            try
            {
                var mapService = new PES.GPS.MapService.MapSearchService.MapService();
                var locationInfo = mapService.InverseGeocoding(latlon);
                if (locationInfo == null)
                {
                    Logger.Error(string.Format("PositionService.GetPosition(string latlon),latlon:{0}获取位置失败", latlon));
                }
                else
                {
                    position = locationInfo.ToString();
                }
            }
            catch (Exception ex)
            {
                Logger.Error(string.Format("PositionService.GetPosition(string latlon),latlon:{0}获取位置失败,error:{1}", latlon, ex.Message), ex);
            }

            return position;
        }