public static IEnumerable <GpxTrackPoint> ToGPX(this SensorLog sensorLog) { return(sensorLog.Data .Where(d => d.HasCoordinates) .Select(d => new GpxTrackPoint() { Bearing = d.LocationTrueHeading , Elevation = d.AltimeterRelativeAltitude , Latitude = d.LocationLatitude.Value , Longitude = d.LocationLongitude.Value , Time = d.LoggingTime })); }
public static SensorLog FromJson(string filePath) { SensorLog sensorLog = new SensorLog(); sensorLog.Data = SensorLogData.FromJson(File.ReadAllText(filePath, Encoding.UTF8)); sensorLog.Count = sensorLog.Data.Count; foreach (var data in sensorLog.Data) { sensorLog.LocationCount += (data.LocationLongitude != 0 && data.LocationLatitude.HasValue) ? 1 : 0; sensorLog.AltitudeCount += (data.LocationAltitude.HasValue) ? 1 : 0; } sensorLog.AltitudeMin = sensorLog.Data.Where(s => s.LocationAltitude.HasValue).Min(s => s.LocationAltitude.Value); sensorLog.AltitudeMax = sensorLog.Data.Where(s => s.LocationAltitude.HasValue).Max(s => s.LocationAltitude.Value); return(sensorLog); }
public static IEnumerable <GeoPoint> ToGeoPoints(this SensorLog sensorLog) { return(sensorLog.Data.Where(d => d.HasCoordinates) .Select(d => new GeoPoint(d.LocationLatitude.Value, d.LocationLongitude.Value, d.AltimeterRelativeAltitude))); }