5

I'm trying to set the map type in the URL using Apple Maps but it doens't seem to be working. What could I do differently? I do this by specifying the type as &t=satellite in the URL, like this:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.apple.com/?daddr=San+Francisco,+CA&saddr=%@,%@&t=satellite", LatitudeCurrentLocation, LongitudeCurrentLocation]]];

Latitude and longitude are NSStrings that contains the latitude and longitude coordinates.

How can I set the may type in the URL?

David Rönnqvist
  • 56,267
  • 18
  • 167
  • 205
  • If you remove the type parameter, does it give you the location you want? What does NSLog say the string is? – thegrinner Jun 17 '13 at 11:56
  • If I remove it and If I leave the type parameter, it does give me the location I want. It launches in apple maps, but the maptype isn't set to satellite or hybrid as desired no matter what, but standard (default). – Daniel Ran Lehmann Jun 17 '13 at 12:00
  • 1
    If it's like googlemaps, you might be able to use `t=k` (see [this answer](http://stackoverflow.com/a/9919251/264775)). – thegrinner Jun 17 '13 at 12:07

1 Answers1

8

By default, Map is display with the graphical map type. You can change the map type to satellite by appending ‘&t=k’,

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.apple.com/?daddr=San+Francisco,+CA&saddr=%@,%@&t=k", LatitudeCurrentLocation, LongitudeCurrentLocation]]];

For more information read This Question and also This Documentation.

Community
  • 1
  • 1
  • More info is available on Apple Documentationhttps://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html may be it is helpful for someone else – Mashhadi Oct 21 '14 at 10:05