I'm currently creating an iOS app with Swift 4. I'm using Firebase
for data storage.
I'm trying to find out what the best way to handle GIS.
Basically, the user will record an activity that will have a lot of waypoints which together will make the activity polyline.
I understand that Strava (a popular activity tracking app) is using OpenStreetMap but with a custom routing engine.
I don't need a routing agent, but I need to be able to calculate distance, moving time, elevating gain, identify the location/region the activity was conducted etc.
First off. I'm using firebase to store all activity data and images etc. However, will it also be suitable for handling GPS data?
First I will need to store all waypoints for an activity. Below is a structure that I think might work. I assume I will need a timestamp for the waypoint to be able to sort them in the right order? Or is there a better way to handle this?
activity_id (auto generates unique id)
activityName: "an activity name"
waypoints
waypoint_id (auto generates unique id)
timestamp:
lat: "latitude"
lon: "longitude"
waypoint_id (auto generates unique id)
timestamp:
lat: "latitude"
lon: "longitude"
activity_id (auto generates unique id)
activityName: "an activity name"
waypoints
waypoint_id (auto generates unique id)
timestamp:
lat: "latitude"
lon: "longitude"
waypoint_id (auto generates unique id)
timestamp:
lat: "latitude"
lon: "longitude"
Data structure built on info from this post How to save tracking polylines in database?
Given that this data structure is efficient and Firebase is a good alternative for storage.
- Can I based on this data, calculate distance, elevation, moving_time, and find location efficiently via Swift?
Sorry. This was a lot of question. Hope you can help point me in the right direction.
While waiting for some response I've done some further digging.
Date and time format seem to typically use standard ISO 8601 and apple support this format ISO 8601dateformatter
Can use Google encoded polyline algorithm format to store polylines to reduce storage size and cost Google polyline algorithm format I found this polyline decoder / encoder in Swift 4
- Is this the recommended approach for storing polylines cost effectively in eg. Firebase?