citymapper/CMMapLauncher

Want to only show CityMapper provider if city is supported

Closed this issue · 2 comments

Currently if I use the following code:

BOOL installed = [CMMapLauncher isMapAppInstalled:CMMapAppCitymapper];
CLLocationCoordinate2D edinburghCentral = CLLocationCoordinate2DMake(55.9531, 3.1889);
if(installed) {
[CMMapLauncher launchMapApp:CMMapAppCitymapper
            forDirectionsTo:[CMMapPoint mapPointWithName:@"Edinburgh Central"
                                              coordinate:edinburghCentral]];
}

Then CityMapper is launched... with a coordinate where navigation is impossible to (the "Get Route" returns an error saying "End is outside London".

How can I determine if a CLLocationCoordinate2D target is supported by Citymapper?

You can use the Citymapper coverage API to determine whether one or more points fall inside Citymapper's coverage areas
https://citymapper.3scale.net/

Perfect, thanks @joehughes . Looking at that API there's not much point adding any functionality in this component. I can't see a non opinonated way of doing it (as this would require adding a networking and potentially a caching dependency).

I'll add an additional check before showing citymapper, which is making a citymapper API call to decide on coverage, then launching / not launching CMMapAppCitymapper.

I'm closing this issue - it's outside the scope of this component.