Class Veery
getLocationHistory(_ format : Int, _ since : Date?, _ until : Date?)
Get the historical geolocation data for the mentioned period.
The format parameter defines the type of historical data the set returned will be filled with : RAW or ROUTEMATCH.
Parameters
Param name | Type | Possible Values / Usage |
---|---|---|
format | int | Veery.HISTORY_RAW : Will return the strictly the data collected |
Veery.HISTORY_ROUTEMATCH : Will return an enhanced version of the data collected representing the estimated trips that the Veery BACKEND or the Veery GEOPROFILE algorithms have deducted from the data. Using the GEOPROFILE activate mode, the trips is computed considering similar days and trips as well as traffic jams and train timetables to compensate the absence of geolocation data during the trips. | ||
since | Date | Represent the time of the beginning of the historical period required. |
nil could be used for "since the beginning" | ||
until | Date | Represent the time of the end of the historical period required. |
nil could be used for "until the end" |
Returns
Veery.LocationsHistory? object
Usage / Example
let cal = Calendar.current // NOW let day = Date() let sinceDate = cal.startOfDay(for: day) // dd-mm-yyyy 00:00:00 let untilDate = sinceDate?.addingTimeInterval(TimeInterval(oneDay - 1)) // dd-mm-yyyy 23:59:59 var renderer: GMUGeometryRenderer! var geoJsonParser: GMUGeoJSONParser! if let locationsHistory = veery.getLocationHistory(Veery.HISTORY_RAW, sinceDate, untilDate){ // if let geojson = locationsHistory.toGeoJSON(geometry: Veery.GEOJSON_MULTIPOINT){ // get location History with GeoJSON MULTIPOINT format geoJsonParser = GMUGeoJSONParser(data: geojson) geoJsonParser.parse() renderer = GMUGeometryRenderer(map: mapView, geometries: geoJsonParser.features) renderer.render() if let boundingbox = locationHistory.getBoundingBox(){ let northest : CLLocationCoordinate2D = boundingbox[1] let southwest : CLLocationCoordinate2D = boundingbox[0] let bounding : GMSCoordinateBounds = GMSCoordinateBounds.init(coordinate:northest, coordinate:southwest ) let camera = GMSCameraUpdate.fit(bounding, withPadding:10.0) self.mapView.animate(with: camera) } } }
GeoJsonLayer classes are available on Google Maps API for IOS
User interaction
none
See also
getLocationHistory
Get the historical geolocation data for the mentioned period.
requestRouteMatch
Request Veery to be warned when a new trip was computed by the backend.
stopRouteMatch
Cancel the call to requestRouteMatch.
Locations.toArray
Extract an array of Location objects from a history.
Locations.toGeoJSON
Get a GeoJson representing the history collected. Get a GeoJson representing the history collected.
Locations.toGeoJSONArray
Get an array of GeoJson representing the history collected. Only valid for Veery.HISTORY_ROUTEMATCH.
[Locations.getBoundingBox] (ios-history-locations-getboundingbox.md)
Get the bounding box of the set of historical data.
veeryRouteMatch
Delegate triggered when the backend computed new trips.