示例#1
0
        public static double speedKMPerhour(GPSHistoryData nowpos , GPSHistoryData prepos)
        {
            double distance = postionToDistanceM(prepos, nowpos);

            TimeSpan ts = (nowpos.Datetime - prepos.Datetime);
            if (ts.TotalSeconds != 0)
            {
                return (distance / ts.TotalSeconds) * ((double)60 * (double)60)/(double)1000;
            }
            else
            {
                return -1;
            }
        }
示例#2
0
        //緯度と経度から最寄駅のリストを検索する
        //路線ごとに異なる駅と判断します
        public List<ClosestStation> requestStationList(GPSHistoryData postion)
        {
            String baseurl = "http://express.heartrails.com/api/json?method=getStations";
            String x = postion.Longitude.ToString();
            String y = postion.Latitude.ToString();
            String url = baseurl + "&x=" + x + "&y=" + y;

            var req = WebRequest.Create(url);
            var res = req.GetResponse();
            ClosestStationResult closeststaion;
            using (res)
            {
                using (var resStream = res.GetResponseStream())
                {
                    var serializer = new DataContractJsonSerializer(typeof(ClosestStationResult));
                    closeststaion = (ClosestStationResult)serializer.ReadObject(resStream);
                }
            }
            return ClosestStationResultConvertToClosestStationList(closeststaion);
        }
 public GPSFormatHistoryData(GPSHistoryData gpshistroydata, double speed)
     : base(gpshistroydata.Datetime, gpshistroydata.Latitude, gpshistroydata.Longitude)
 {
     this.speed = speed;
 }