Gpx.GpxTrackPoint SetGpxPoint(Models.GpxPoint pt, DateTime?inicio) { /* * Sacar elevacion * https://secure.geonames.org/srtm3JSON?lat=43.528641&lng=-6.523797&username=galwayireland * {"srtm3":107,"lng":-6.523797,"lat":43.528641} */ var pto = new Gpx.GpxTrackPoint(); pto.Elevation = pt.Ele ?? 1; if (pt.Lat < 25) { pto.Latitude = (Double)(pt.Lon ?? 0); pto.Longitude = (Double)(pt.Lat ?? 0); } else { pto.Latitude = (Double)(pt.Lat ?? 0); pto.Longitude = (Double)(pt.Lon ?? 0); } if (inicio.HasValue && pt.Time.HasValue) { DateTime dt = DateTime.Now; TimeSpan ts = pt.Time.Value - inicio.Value; pto.Time = dt + ts; } else { pto.Time = DateTime.Now; } return(pto); }
Gpx.GpxWayPoint SetGpxWayPoint(Models.GpxPoint pt) { var pto = new Gpx.GpxWayPoint(); pto.Elevation = (Double?)pt.Ele; pto.Latitude = (Double)(pt.Lat ?? 0); pto.Longitude = (Double)(pt.Lon ?? 0); return(pto); }