mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Export route to CSV
This commit is contained in:
parent
5dd805cb2d
commit
056dabfadb
3 changed files with 60 additions and 2 deletions
|
|
@ -96,3 +96,27 @@ func positionToCsvFile(positions: [PositionEntity]) -> String {
|
|||
}
|
||||
return csvString
|
||||
}
|
||||
|
||||
|
||||
func routeToCsvFile(locations: [LocationEntity]) -> String {
|
||||
var csvString: String = ""
|
||||
let localeDateFormat = DateFormatter.dateFormat(fromTemplate: "yyMMddjmma", options: 0, locale: Locale.current)
|
||||
let dateFormatString = (localeDateFormat ?? "MM/dd/YY j:mma").replacingOccurrences(of: ",", with: "")
|
||||
// Create Position Header
|
||||
csvString = "Id, Latitude, Longitude, Altitude, Speed, Heading"
|
||||
for loc in locations {
|
||||
csvString += "\n"
|
||||
csvString += String(loc.id)
|
||||
csvString += ", "
|
||||
csvString += String((loc.latitude ?? 0))
|
||||
csvString += ", "
|
||||
csvString += String(loc.longitude ?? 0)
|
||||
csvString += ", "
|
||||
csvString += String(loc.altitude)
|
||||
csvString += ", "
|
||||
csvString += String(loc.speed)
|
||||
csvString += ", "
|
||||
csvString += String(loc.heading)
|
||||
}
|
||||
return csvString
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue