<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Robertdot, A Web Design Blog &#187; Google Maps</title>
	<atom:link href="http://robertdot.org/tags/google-maps/feed/" rel="self" type="application/rss+xml" />
	<link>http://robertdot.org</link>
	<description>A web design blog for designers that develop or developers that design.</description>
	<lastBuildDate>Fri, 05 Mar 2010 15:59:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding Location Awareness to Your Site</title>
		<link>http://robertdot.org/2009/01/09/adding-location-awareness-to-your-site/</link>
		<comments>http://robertdot.org/2009/01/09/adding-location-awareness-to-your-site/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 19:46:52 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Fire Eagle]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[Location Services]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[Yahoo Weather]]></category>

		<guid isPermaLink="false">http://robertdot-org.robertb.org/?p=18</guid>
		<description><![CDATA[
 I recently launched a new personal site.  I wanted to integrate some level of location awareness to it.  My initial design sketches called for the weather information and a position on a map of my last known location.


 Initially, I was using a program on my iPhone called Loopt.  Loopt is like Twitter with [...]]]></description>
			<content:encoded><![CDATA[<p>
 I recently launched a new personal site.  I wanted to integrate some level of location awareness to it.  My initial design sketches called for the weather information and a position on a map of my last known location.
</p>
<p>
 Initially, I was using a program on my iPhone called Loopt.  Loopt is like Twitter with location.  That involved jumping through hoops, as Loopt&#8217;s RSS feed only shows the GPS position of the last post.  Not only would I have to post a message every time I got somewhere, I&#8217;d have to reverse geocode my position to grab the zip code to send to get the weather information.  I achieved this through JavaScript with the Google Maps API.  This worked until I found out about <a href="http://fireeagle.yahoo.net/">Fire Eagle</a>.
</p>
<p>
 All Fire Eagle does is log your location.  Luckily, Fire Eagle has an <abbr title="Application Programming Interface">API</abbr>.  <a href="http://www.eaglefeed.me">Eagle Feed</a> turns your location into a publicly accessible <abbr title="Really Simple Syndication">RSS</abbr> feed.  So, getting your location is as easy as parsing an RSS feed.  By setting the read level of Eagle Feed to <samp>my zip code</samp>, the <code>title</code> of the single <code>item</code> in the RSS feed reports my city, state, and zip (e.g. <samp>Birmingham, AL 35223</samp>), and my GPS coordinates are also in the feed.
</p>
<p>
 You can update Fire Eagle by manually by entering your location on the site.  However, there are mobile applications, such as Active Eagle on the iPhone, that use the <abbr title="Global Positioning Satellite">GPS</abbr> functionality of your device to update Fire Eagle.  In Active Eagle, I simply tap &#8220;Update Fire Eagle&#8221; to update my location, and my Eagle Feed.
</p>
<p>
 Once you can get your feed there are plenty of cool things you can do.
</p>
<p>
 I wrote a simple <abbr title="PHP Hypertext Preprocessor">PHP</abbr> script to open my feed (or pull it from a cached file), grab the human-readable location from the <code>title</code> and parse out the zip code and my GPS position.
</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$out</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$feed_url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/&lt;title&gt;(.*?)&lt;\/title&gt;/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$out</span><span style="color: #339933;">,</span> <span style="color: #000088;">$loc_matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$human_loc</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$loc_matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/\d{5}/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$human_loc</span><span style="color: #339933;">,</span> <span style="color: #000088;">$loc_matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$human_zip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$loc_matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/&lt;abbr class=&quot;latitude&quot;.*?&gt;(.*?)&lt;\/abbr&gt;/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$out</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lat</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$loc_lat</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$lat</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/&lt;abbr class=&quot;longitude&quot;.*?&gt;(.*?)&lt;\/abbr&gt;/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$out</span><span style="color: #339933;">,</span> <span style="color: #000088;">$long</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$loc_long</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$long</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>
 I then pass my zip code to <a href="http://developer.yahoo.com/weather/">Yahoo&#8217;s weather feeds</a> to get weather data.  I also pass my GPS position to <a href="http://code.google.com/apis/maps/documentation/staticmaps/">Google Maps Static API</a> to get a map of where I am.
</p>
<p>
 Another idea would be to show Flickr photos in your area via the <a href="http://www.flickr.com/services/api/">Flickr API</a>.  I&#8217;m sure there are tons of other things that would be fun or useful.  Come up with some more ideas and make some cool stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://robertdot.org/2009/01/09/adding-location-awareness-to-your-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
