TerryT TerryT - 23 days ago 8
iOS Question

Redirect to Apple Maps with "Avoid Highways" automatically selected

We have an app that allows users to check-out and ride a certain type of vehicle, and I want to build a button that, when pressed, redirects them to their default navigation app, optionally with a destination pre-selected. Crucially, this vehicle is not allowed on highways, so we do not ever want to direct users to a route with highways in it.

Right now, I am stuck because it looks like I cannot launch Apple Maps with "avoid highways" selected. I am using the URL

"http://maps.apple.com/daddr=0,0&dirflg=h"
, but
&dirflg=h
did not work for me, neither did
&avoid=highways
or
&avoid=h
. Looking at Apple's documentations, it appears that this param just isn't available: https://developer.apple.com/library/content/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html

It looks like for iOS users I would have to redirect them to use Google Maps instead, which I can do according to the Google Maps iOS SDK docs: https://developers.google.com/maps/documentation/ios-sdk/urlscheme. Is that true? Is there really no way to open Apple Maps with 'avoid highways' selected?

Answer

Yep—from that documentation it looks like there’s indeed no flag for that setting in the request URL. You may want to file an enhancement request on MapKit for that feature.