Flash Resolution-Week 3: Google Maps API + iPhone GPS Tracking

To build on my previous post about the Google Maps ActionScript API, I wanted to track the position of my iPhone in real time. I came across the site instamapper.com. After creating a free account with Instamapper and downloading their iPhone app from the Apple App Store, I was tracking my phone in no time. They have prebuilt maps that you can embed on your blog and even a Facebook application. Although I wanted to use my own map so I can have more control over the map. Instamapper has a simple little API that you can use to retrieve your information. A http call returns a string of all the data about your phone's location. Using a URLLoader to load in the request (http://www.instamapper.com/api?action=getPositions&key=584014439054448247) returns the data:

InstaMapper API v1.00
0071543339995,Demo car,1209252615,47.58822,-122.17969,25.0,27.7,349

The format of each record (seporated by commas) is as follows:

  1. Device key
  2. Device label
  3. Position timestamp in UTC (number of seconds since January 1, 1970)
  4. Latitude
  5. Longitude
  6. Altitude in meters
  7. Speed in meters / second
  8. Heading in degree

So using a split() method on the returned string, I could just parse the latitude and longitude coordinates and sent them to my Google map object. Here is a screen shot of my application. The only problem is that instamapper.com does not (yet) have a cross domain policy, which is not allowing the SWF on my server to access instamapper's server. Though it works just fine when run locally. So for now, this is just a proof of concept.

Leave a Comment

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