I am working on a project where I have to distinguish the mobility type ( car, tramway, bus, train, subway... ) I am currently using a speed system to distinguish most of them using a min and max for each type ( not efficient you will say :) ) But here comes to the problem when I want to distinguish car & subway for example - they have both the same speed ( more or less ) but the only thing which distinguish them are the place where the currently are RAILWAYS and ROUTE(?).
Idea : using OpenStreetMap and check if 90% of the journey was on a railway or not...
What do you think ? do you have any other idea I might have not think about, never used OpenStreetMap before and it's bothering me to use cellular data though...
Thanks for your help !
EDIT ( thanks to responses I got - thanks ! ) : Here is what I came up with, if you've got other idea to make it more accurate let me know :)
[_motionActivityManager startActivityUpdatesToQueue:[[NSOperationQueue alloc] init] withHandler:^(CMMotionActivity *activity) {
dispatch_async(dispatch_get_main_queue(), ^{
if ([activity stationary] && !isStationnary)
{
isStationnary = TRUE;
MKLocalSearchRequest *request = [[MKLocalSearchRequest alloc] init];
request.naturalLanguageQuery = @"Train station";
request.region = MKCoordinateRegionMakeWithDistance(UIApplication sharedApplication.tracker.lastKnownLocation.coordinate, 500, 500);
MKLocalSearch *search = [[MKLocalSearch alloc] initWithRequest:request];
[search startWithCompletionHandler:^(MKLocalSearchResponse *response, NSError *error) {
for (MKMapItem *item in response.mapItems) {
CLCircularRegion *region = [[CLCircularRegion alloc] initWithCenter:item.placemark.coordinate radius:50
identifier:@"train station region"];
if ([region containsCoordinate: UIApplication sharedApplication.tracker.lastKnownLocation.coordinate]) {
NSLog(@"IN REGION! %@", item);
}
else {
NSLog(@"NOT IN REGION! %@", item);
}
}
}];
}
else if ([activity walking])
{
isStationnary = FALSE;
}
});
}];
You can export just the data you need from OpenStreetMaps using the OSM XAPI. This might give you an acceptable file size to ship with the app.
I guess you will have issues with the GPS accuracy inside the car or tram. The distance between the tram route and the cars is probably less than the horizontal accuracy of the GPS positions you get from the phone.
You could look at the position at which the user sat down (i.e. stopped walking). If this is close to a tram station or the users house that will give you a good indication.