public List<string> GetPositions(LatLon[] array) { List<string> lsLocation = new List<string>(); try { IMapService mapService = new PES.MapService.MapSearchService.MapService(); IList<LocationInfo> list = mapService.InverseGeocoding(array); if (list.Count == 0) { Logger.Error(string.Format("获取位置失败")); } else { for (int i = 0; i < list.Count;i++ ) { lsLocation.Add(list[i].ToString()); } } } catch (Exception ex) { Logger.Error(string.Format("获取位置失败,error:{2}", ex.Message)); } return lsLocation; }
public virtual string Encode(LatLon[] latlons) { MapUrlCallLogHelper.WriteMapUrlCallLog(MapUrlCallLogEnum.Encode); string postString = string.Format("latlon={0}&customer=1", LatLon.ToParasString(latlons)); string responseText = WebRequestHelper.UploadData(URL_ENCODE, postString, TIMEOUT_BATCH, Encoding.UTF8); return responseText; }
public static string ToParasString(LatLon[] arrLatLon) { if (arrLatLon == null || arrLatLon.Length == 0) return string.Empty; StringBuilder sb = new StringBuilder(); foreach (LatLon latlon in arrLatLon) { sb.AppendFormat("{0},{1};", latlon.Latitude, latlon.Longitude); } return sb.ToString().TrimEnd(';'); }
private bool IsAllIn(LatLon[] arr, out IList<LocationInfo> ltLocationInfo) { ltLocationInfo = new List<LocationInfo>(); foreach (var item in arr) { LocationInfo temp; if (!InArea(item.Latitude, item.Longitude, out temp)) return false; ltLocationInfo.Add(temp); } return true; }
private List<EGPSHistoryInfo> GetGPSHistoryInfoList(Guid vehicleCode, VGPSInstallationInfo installation, EHistoryDataStoreConfig tableConfig,LatLon max,LatLon min,params string[] arrColumnName) { if (tableConfig == null) return null; string columnNames = arrColumnName.Length == 0 ? "*" : string.Join(",", arrColumnName); string sqlText = string.Format("select {8} from {0} where gpsCode = '{1}' and reporttime between '{2}' and '{3}' and speed > 0 and ACCState = 1 and Longitude between '{4}' and '{5}' and Latitude between '{6}' and '{7}' order by ReportTime asc ", tableConfig.StoreTable.TableName, installation.GpsCode, installation.CreateDate, installation.StopDate, min.Longitude, max.Longitude, min.Latitude, max.Latitude, columnNames); return List(vehicleCode, tableConfig, sqlText, arrColumnName); }
private Dictionary<VGPSInstallationInfo, IList<EGPSHistoryInfo>> GetDictionary(Guid vehicleCode, IList<VGPSInstallationInfo> gpsCodeList, LatLon max, LatLon min) { var tableConfig = GetVehicleStoreTableConfig(vehicleCode); var dic = new Dictionary<VGPSInstallationInfo, IList<EGPSHistoryInfo>>(); foreach (VGPSInstallationInfo gpsCode in gpsCodeList) { List<EGPSHistoryInfo> currentHistoryInfo = GetGPSHistoryInfoList(vehicleCode, gpsCode, tableConfig,max,min); if (currentHistoryInfo != null && currentHistoryInfo.Count > 0) { dic.Add(gpsCode, currentHistoryInfo); } } return dic; }
private Dictionary<VGPSInstallationInfo, IList<EGPSHistoryInfo>> GetDictionary(Guid vehicleCode, DateTime beginTime, DateTime endTime, LatLon max, LatLon min) { IReportService reportService = new ReportService(); var dic = new Dictionary<VGPSInstallationInfo, IList<EGPSHistoryInfo>>(); IList<VGPSInstallationInfo> gpsCodeList = reportService.GetGpsRelationList(vehicleCode, beginTime, endTime); return GetDictionary(vehicleCode, gpsCodeList,max,min); }
/// <summary> /// 获取车辆在指定区域的历史轨迹 /// </summary> /// <param name="vehicleCode"></param> /// <param name="beginTime"></param> /// <param name="endTime"></param> /// <param name="max"></param> /// <param name="min"></param> /// <returns></returns> private IList<VGPSHistoryRunInfo> GetHistoryLocus(Guid vehicleCode, DateTime beginTime, DateTime endTime, LatLon max, LatLon min) { Dictionary<VGPSInstallationInfo, IList<EGPSHistoryInfo>> dic = this.GetDictionary(vehicleCode, beginTime, endTime,max,min); IList<EGPSHistoryInfo> ltHistoryInfo_All = GetUpdateMileageHistory(dic); if (ltHistoryInfo_All == null || ltHistoryInfo_All.Count == 0) { return null; } IList<VGPSHistoryRunInfo> ltHistoryRunInfo = GetHistoryRunInfo(ltHistoryInfo_All); return ltHistoryRunInfo; }
public void DecodeTest() { PES.MapService.MapSearchService.IMapService target = new PES.MapService.MapSearchService.MapService(); string source = "ISGRCFVUADRDDG"; LatLon latlons = new LatLon(22.593m,113.87087m); LatLon actual = target.Decode(source); if (latlons.Longitude != actual.Longitude || latlons.Latitude != latlons.Latitude) { Assert.Fail("Encode() failed, result:{0},{1}",actual.Latitude,actual.Longitude); } }
public void EncodeArrayTest() { PES.MapService.MapSearchService.IMapService target = new PES.MapService.MapSearchService.MapService(); LatLon[] latlons = new LatLon[] { new LatLon(22.593m,113.87087m), new LatLon(22.97033m,113.33485m) }; string[] expected = new string[] { "ISGRCFVUADRDDG", "IRAFFVXTWWTDGA" }; string []actual; actual = target.Encode(latlons); if (expected[0] != actual[0] || expected[1] != actual[1]) { Assert.Fail("Encode() failed, result:{0},{1}", actual[0], actual[1]); } }