views:

3872

answers:

4

I would like to create an iPhone app that can open the google maps app and place a pin on the map.

I have the exact location of the pin, specified by its longitude and latitude. I also have a name for the pin e.g. 'location 1' that should be displayed along with the pin.

I know that UIApplication:openURL can be used for this but I don't know the exact url format.

So, is there a way to do what I described above? If, yes, what is the correct url format?

+7  A: 

You can use a URL of the format: http://maps.google.com/maps?q=Your+Location+name@latitude,longitude

http://maps.google.com/[email protected],-87.6315

Ben Gottlieb
Thanks for your reply, it seems that the second link you provide is not working. It is actually the same as the first one.
Panagiotis Korros
There was a space in the URL. Try it now.
Ben Gottlieb
A: 

A reference guide to all URLs supported by the iPhone OS: iPhone URL Scheme Reference. Requires logging in as a registered iPhone developer (free).

millenomi
+1  A: 

You can drop up to 100 pins using KML. There is an example of this on http://appsamuck.com look at the example for day 8 (http://appsamuck.com/day8.html)

Jamey McElveen
A: 

Why should your user have to exit your app to see a map. You can embed a Google map in your application easily. You can even drop multiple pins for which you have lat & long information.

In fact, in my opinion your user should never have to leave your application to view a google map.

An example of how to do this is included as an example application at https://sourceforge.net/projects/quickconnect/.

Download the QuickConnectiPhone zip file and you will find it in the Examples directory.

Lee
Due to license restrictions, you can’t use Turn-Based directions in your own MKMapView if you use Google’s map tiles.
Raphael Schweikert