views:

6281

answers:

3

Is there an easy way to design a website to facilitate an iphone user providing gps coordinates to the site?

I am wondering if there might be a naming convention for form fields for example, to let the user input in an automated way.

I am considering building a location based website and would like to tailor it for iphone (and other mobile users). I realize an iphone app could do this but I'm not equipped to create one.

+7  A: 

Here's a snippet on how to read location from the iPhone. Looks like it requires 3.0:

 navigator.geolocation.getCurrentPosition(foundLocation, noLocation);

 function foundLocation(position)
 {
   var lat = position.coords.latitude;
   var long = position.coords.longitude;
   alert('Found location: ' + lat + ', ' + long);
 }
 function noLocation()
 {
   alert('Could not find location');
 }

See: http://mapscripting.com/how-to-use-geolocation-in-mobile-safari

By the way, if you want to use web code on the iPhone, there are a couple middle-ground solutions you could try that don't force you to create a native app but allow you to wrap your site in an app and get access to GPS and other native features.

Maciek
Just as hint: flickr.com is doing this with its mobile version already. You can view pictures taken nearby your current location.
housemaister
Very cool, thanks for that reference.
Maciek
Also, Firefox implemented this same interface in version 3.5. So basically you can use that same code in Firefox (if that matters to you).
musicfreak
+1  A: 

I've don this without any programming. You can:

  1. Download the iPhone app "Basic GPS" from iPhone Store.
  2. Start an account at Twitter.com (if you don't already got one).
  3. Start an e-mail-to-twitter account at Twittermail.com.
  4. In Basic GPS settings use your secret e-mail address from Twittermail.
  5. At Twitter.com/widgets click "Other" to get your HTML-code for publishing your Tweets elsewhere.
  6. Put this HTML code on your homepage.
  7. In Basic GPS you just click the blue "I" (on) button, "Email" and "Send" to send your position to Twittermail, which publish it on Twitter. And Twitter will automaticly publish it on your homepage.

See a working axample at http://CharlieBloom.com. Only the 3 latest (customizeable) Tweets are visible, click on "Follow me on Twitter" to se "My position ....." and a Google Maps-link. Positions are updated on my website 2-3 minutes after I have sent them.

Best regards, Charlie Bloom

A: 

GSP TO SMS App can send an email with gps data - you could write a script that checks the email (pop3/imap) and publishes its content on the website.

GPS TO SMS Homepage

Vitrex