Random mutterings of Alastair James

OneWheeledBicycle

Please Google, can we have Google Maps API for iPhone?

September 25th, 2008 by alastair

I have recently been experimenting with writing travel related web apps for the iphone. Its all great. Some of the HTML5 stuff in the new version of iPhone Safari is great (local databases etc..). However, one thing has been bothering me. I cant use Google Maps as I would like to. Ok, I can include links to the google maps site that open in the native google maps application, but this is not optimal because:

  • It takes the user out of my web application
  • Does not allow me to integrate the maps with my application. I.e. add many markers. Do something when a marker is clicked.

So this got me thinking, would it be possible to do a ‘lite’ version of the javascript maps API for the iPhone? Before the newest version of mobile Safari, this would not have been possible. Fundamentally you cant drag the map! However, with the new version Apple introduced a javascript API for sensing single and double finger drag events. 

So, I went about knocking up a very basic test version (try it on your iphone, tinyurl: http://tinyurl.com/3g5tg4). Is buggy, basic and sub-optimal, but proves it could work nicely. Try zooming with the double finger pinch action! 

I also tried the new webkit CSS transforms to allow free zooming and rotation, however they are buggy and slow on the iphone! Oh well! Anyway, maybe we can have google maps lite on the iphone?

13 Responses

  1. Ajaxian » Google Maps JavaScript API on the iPhone Says:

    […] iPhone experience. Alastair James wanted to use the Google Maps JavaScript API on the iPhone, and wrote up his thoughts: Before the newest version of mobile Safari, this would not have been possible. Fundamentally you […]

  2. Antoine Quint Says:

    Alastair, what were the issues you experienced with CSS transforms and did you file bug reports? It would be very useful for us at Apple to get more information about the issues you encountered? Feel free to email me to discuss this.

  3. Wes Biggs Says:

    Alastair, this is very cool. Does it take lat/long coordinates? If so I’ll hook it into Locatable (http://lbs.tralfamadore.com) so it can get a CoreLocation reading (or you can integrate the W3C javascript API).

  4. alastair Says:

    @Wes Biggs. No not yet. I have yet to implement any lat/lng to pixel transforms. I will drop you a line when done!

  5. Pamela Fox Says:

    Cool demo, but please change it to use a different mapping provider if you’re going to continue working on it. Creating wrapper APIs with our tiles isn’t permitted by the Terms of Use. Thanks!

  6. alastair Says:

    @Pamela Yup, sorry, changed to openstreet map tiles now…

  7. Google Maps JavaScript API for iPhone Says:

    […] September 26, 20081:59 am Google Maps JavaScript API for iPhone Alastair James wanted to optimize Google Maps usage in his mobile apps, but that wasn’t […]

  8. Google Maps JavaScript API on the iPhone » Good Idea, Bad Idea Says:

    […] iPhone experience. Alastair James wanted to use the Google Maps JavaScript API on the iPhone, and wrote up his thoughts: Before the newest version of mobile Safari, this would not have been possible. Fundamentally you […]

  9. Tuinslak Says:

    Do you happen to know if there is anyway to access the “directions” on the iPhone Maps app?

    I have an iPhone website, that adds a simple “maps.google.com/?q=location1 to location2″ (e.g.: http://maps.google.be/?q=vilvoorde%20to%20antwerp), but when clicking that URL from an iPhone, Maps errors with “no results”. While it should get loaded under the “directions” tab.

    Any idea?

    Thanks.

  10. alastair Says:

    @Tuinkslak

    Check here: http://developer.apple.com/webapps/docs/documentation/AppleApplications/Reference/SafariWebContent/AppleApplicationsURLSchemes/chapter_950_section_4.html#//apple_ref/doc/uid/TP40006513-SW5 (ADC membership required).

    I think you use the ’saddr’ parameter for the source address and ‘daddr’ for the destination. I.e. http://maps.google.com/?saddr=vilvoorde&daddr=antwerp

  11. Tuinslak Says:

    Thanks a lot! Seems to be working now. Guess I didn’t search far enough.

  12. iRail maps | Tuinslak Says:

    […] thanks to alastair for helping out on this […]

  13. Chris Glode Says:

    Check out mapNinja, it’s an iPhone SDK that lets you enable your apps with a google-maps style experience in just a matter of minutes. No javascript hacks, this is a pure native application for iPhone.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.