<?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>SizzlaBlog &#187; Google Maps</title>
	<atom:link href="http://www.blog.sizzla-media.co.uk/tag/google-maps/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blog.sizzla-media.co.uk</link>
	<description>Flash, Web and Javascript development</description>
	<lastBuildDate>Sun, 15 Aug 2010 11:41:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<image>
  <link>http://www.blog.sizzla-media.co.uk</link>
  <url>http://blog.sizzla-media.co.uk/favicon.ico</url>
  <title>SizzlaBlog</title>
</image>
		<item>
		<title>Showee &#8211; A proof of concept</title>
		<link>http://www.blog.sizzla-media.co.uk/2010/02/17/showee-a-proof-of-concept/</link>
		<comments>http://www.blog.sizzla-media.co.uk/2010/02/17/showee-a-proof-of-concept/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 22:16:16 +0000</pubDate>
		<dc:creator>Leon</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[web app]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[iphone os]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[mobile safari]]></category>

		<guid isPermaLink="false">http://www.blog.sizzla-media.co.uk/?p=463</guid>
		<description><![CDATA[For a while now i&#8217;ve been toying with the idea of creating an iPhone App. Due to my knowledge of web technologies such as XHTML and Javascript, I wanted to see how I could create an iPhone application using these (&#8230;)</p><p><a href="http://www.blog.sizzla-media.co.uk/2010/02/17/showee-a-proof-of-concept/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" title="showee" src="http://static.leonbarrett.com/images/startup.png" alt="" width="320" height="460" /></p>
<p>For a while now i&#8217;ve been toying with the idea of creating an iPhone App. Due to my knowledge of web technologies such as XHTML and Javascript, I wanted to see how I could create an iPhone application using these techniques. With wanting to learn some of the new features <a href="http://dev.w3.org/html5/spec/Overview.html" target="_blank">HTML 5</a> would offer, I decided to create an app that tied into the GeoLocation API now available to the iPhone, via the 3.0 update.</p>
<p>Without planning anything out, I dived right into the <a href="http://dev.w3.org/geo/api/spec-source.html" target="_blank">HTML5 Geo Location spec</a> and  successfully outputted the location as a Lat and Long value. This was pretty cool, but a lat and long on their own were pretty pointless (see what I did there).</p>
<p>I&#8217;d previously done some work using the Google Maps API and Flash (now no longer working due to an outdated version of the GMaps API), and thought i&#8217;d try my hand at plotting your current location on a Google Map.</p>
<p>This worked and I decided that rather than just showing your location, i&#8217;d tie this in with the Google Local Search API and allow you to search for things near your location.</p>
<p>Now before anyone starts moaning and saying that this functionality is already available, I wanted to create a Web App for a number of reasons:</p>
<ul>
<li>To see how close I could get to the look and feel of a native app.</li>
<li>To learn some shiny new <a href="http://en.wikipedia.org/wiki/HTML5" target="_blank">HTML5</a>.</li>
<li>I needed a little sideline project.</li>
<li>It could become a base for some sort of snazzy location based events app.</li>
</ul>
<p>So onto the actual app &#8211; I called it Showee and if you navigate to <a href="http://www.showee.me" target="_blank">http://www.showee.me</a> on your iPhone you&#8217;ll be able to see it in all it&#8217;s glory, (if you try it in a regular browser, you probably won&#8217;t see anything yet as I haven&#8217;t created a non iPhone version).</p>
<p>First thing to do is tap the (+) and choose &#8216;Add to home screen&#8217;, this way you&#8217;ll be able to appreciate how close this looks and feels like a native app (there is a status bar that gives you feedback about what the application is doing).</p>
<p>On load you will be asked to share you location. If you accept the application will determine your location and place a blue dot at your location. If the accuracy is greater than 20m it will keep checking your location for an improvement. Once your location has been determined to within 20m the app will stop searching.</p>
<p>At the moment that is pretty much it, but I plan to add more features in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.sizzla-media.co.uk/2010/02/17/showee-a-proof-of-concept/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Locator Panel update</title>
		<link>http://www.blog.sizzla-media.co.uk/2008/04/07/locator-panel-update/</link>
		<comments>http://www.blog.sizzla-media.co.uk/2008/04/07/locator-panel-update/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 10:11:31 +0000</pubDate>
		<dc:creator>Leon</dc:creator>
				<category><![CDATA[General Info]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[GMap]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[locator panel]]></category>

		<guid isPermaLink="false">http://www.blog.sizzla-media.co.uk/?p=225</guid>
		<description><![CDATA[The Locator Panel has now been updated to v1.2. The update improves the functionality of the Map, in terms of being controlled by the keyboard and mouse. It also improves feedback when a connection is lost or cannot be found. (&#8230;)</p><p><a href="http://www.blog.sizzla-media.co.uk/2008/04/07/locator-panel-update/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.blog.sizzla-media.co.uk/wp-content/uploads//search_glass.jpg" alt="" width="100" height="92" /></p>
<p>The Locator Panel has now been updated to v1.2. The update improves the functionality of the Map, in terms of being controlled by the keyboard and mouse. It also improves feedback when a connection is lost or cannot be found.</p>
<p>You can download the panel from <a title="download locator Panel" href="http://www.blog.sizzla-media.co.uk/wp-content/uploads//locator.mxp">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.sizzla-media.co.uk/2008/04/07/locator-panel-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash/GoogleMaps mashup!</title>
		<link>http://www.blog.sizzla-media.co.uk/2008/03/28/flashgooglemaps-mashup/</link>
		<comments>http://www.blog.sizzla-media.co.uk/2008/03/28/flashgooglemaps-mashup/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 19:22:47 +0000</pubDate>
		<dc:creator>Leon</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[mashup]]></category>

		<guid isPermaLink="false">http://www.blog.sizzla-media.co.uk/index.php/2008/03/28/flashgooglemaps-mashup/</guid>
		<description><![CDATA[I&#8217;ve have created my first true web mash-up using Flash and the Google Maps API. Firstly check it out here, and then head back to read the steps involved. Note! At the moment I have manually limited the search to (&#8230;)</p><p><a href="http://www.blog.sizzla-media.co.uk/2008/03/28/flashgooglemaps-mashup/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.blog.sizzla-media.co.uk/map/gmaps%20mashup.html" target="_blank"><img src="http://www.google.com/intl/en_ALL/images/maps_results_logo.gif" border="0" alt="" width="150" height="55" /></a></p>
<p>I&#8217;ve have created my first true web mash-up using Flash and the Google Maps API. Firstly check it out <a href="http://www.blog.sizzla-media.co.uk/map/gmaps%20mashup.html" target="_blank">here</a>, and then head back to read the steps involved.</p>
<p>Note! At the moment I have manually limited the search to UK and there is no option to remove a marker/pin.</p>
<p>I was first inspired to create this after stumbling across the <a href="http://www.afcomponents.com/components/g_map/" target="_blank">GMap Flash component from AFC. </a> I liked the idea of having the Google Maps experience within Flash. As a Flash developer I have more control and flexibility over how the application would work. I could also add my own interface around the component and integrate it into any projects, plus if I needed to hook up to  a mySQL database.</p>
<p>While the GMap component is brilliant there wasn&#8217;t a search function built in. This meant that locations were hard coded into the ActionScript. My plan was to create an application where the user could search for a location and have it displayed within Flash.</p>
<p>Note! In order to create this for yourself you need a Google Maps API Key</p>
<p>There are three main components that work together to create the search function:</p>
<p>Flash &gt; PHP &gt; Google Maps API &gt; PHP &gt; Flash (GMap component)</p>
<p>I&#8217;ll break each stage down into its core functionality. I&#8217;ll assume that you know ActionScript 2.0 and PHP.</p>
<p>You will also need the CURL extension installed on your sever.</p>
<p><strong>Flash to PHP </strong></p>
<p>The first step was to capture some data from Flash and send that to a PHP page.  Inside Flash I created a function that took the input from a text box and sent this to a server  side script (my PHP page).  This was achieved using the LoadVars function of Flash:</p>
<pre>var dataURL:String = PHP script on my server</pre>
<pre>var getLoc:LoadVars = new LoadVars();

function sendData(){
    var loc:String = searchLoc.text;
    getLoc.load(dataURL + "?searchLoc=" + loc);
}

searchBtn.onPress = function(){
sendData();
}</pre>
<p>This assumes that you have a textbox and button object on the stage.</p>
<p><strong>PHP to GoogleMaps API</strong></p>
<p>We have now sent the data to a PHP page called that is sitting on my server. The page was modified from a script from <a href="http://www.coastrentals.com/tech/2006/09/20/php-geocoding-tutorial-with-the-google-maps-api-part-one/" target="_blank">here</a>. The GoogleMaps API takes a location in the form of a querystring and returns back either a set of Comma Seperated Values or XML data. In this case I am interested in the CSV. The CSV contained Longitude and Latitude co-ordinates which the GoogleMaps API needs to determine a position.</p>
<pre>&lt;?php</pre>
<pre>//Set up our variables</pre>
<pre>$longitude = "";</pre>
<pre>$latitude = "";</pre>
<pre>//Three parts to the querystring: q is address, output is the format (</pre>
<pre>$key = "get your own API!";</pre>
<pre>$address = urlencode($_GET["searchLoc"]);</pre>
<pre>$url = "http://maps.google.com/maps/geo?q=".$address."&amp;output=csv&amp;key=".$key;</pre>
<pre>$ch = curl_init();</pre>
<pre>curl_setopt($ch, CURLOPT_URL, $url);</pre>
<pre>curl_setopt($ch, CURLOPT_HEADER,0);</pre>
<pre>curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);</pre>
<pre>curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);</pre>
<pre>curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);</pre>
<pre>$data = curl_exec($ch);</pre>
<pre>curl_close($ch);</pre>
<pre>if (strstr($data,'200'))</pre>
<pre>{</pre>
<pre>$data = explode(",",$data);</pre>
<pre>$longitude = $data[3];</pre>
<pre>$latitude = $data[2];</pre>
<pre>echo "&amp;myLong=".$longitude."&amp;myLat=".$latitude."&amp;";</pre>
<pre>} else {</pre>
<pre>echo "&amp;error=Error in getting location";</pre>
<pre>}</pre>
<pre>?&gt;</pre>
<p>The above code has just taken the Lat and Long from the Data array (created from the CSV values) and echoed these out. You will notice that I have assigned the values to two variables. I will use these within Flash to give the GMap component its required data.<a href="http://blog.sizzla-media.co.uk/map/map.php?searchLoc=walsall" target="_blank"></a></p>
<p>We have now sucessfully sent our search term to the PHP script, sent the required querystring to the GoogleMaps API and returned the data we need back to the PHP script. We have then used the echo function of PHP to print the Latitude and Longitude to two variables.</p>
<p><strong>PHP to Flash</strong></p>
<p>Once back inside the Flash a function is called when Flash receives the data from the PHP page:</p>
<pre>getLoc.onLoad = dataLoaded;</pre>
<pre>function dataLoaded(){</pre>
<pre>_global.myLat = getLoc.myLat</pre>
<pre>_global.myLong = getLoc.myLong</pre>
<pre>}</pre>
<p>This script assigns two variables in Flash to the variables of Lat and Long sent from the PHP and constructs the map. See the GMap documentation to see how this is done.</p>
<p>The GMap component then queries the GoogleMaps API to get the location back. Thats it!! Simple wasn&#8217;t it.</p>
<p>I&#8217;ve added a few more features using the Flash API such as a data grid to display the search results. By clicking on a result the user will be taken to the location of that search. Try entering in a few random towns around the UK to see this work.</p>
<p>I&#8217;ve also added the ability to drop markers on a location and saves its position. I have created this using the arrays and a counter (to increment the number for the marker). The arrays store the location name, lat and long values.</p>
<p>I next plan to link this with a MySQL database so that a user could log in and save their positions. This would be fairly simple as I already have an array with all of the search data. I could simply save the array and then load it back into Flash the next time the user logged in.</p>
<p>I plan to make the code available once it has been tidied up.</p>
<p><strong>Update!!</strong> I have updated the mashup so that it now includes the following:</p>
<ul>
<li>Search history of locations</li>
<li>Pop up descriptions for each location marker</li>
<li>Different colours for markers (to distinguish between, search, custom and history)</li>
<li>Auto complete function on text entry</li>
<li>The help button DOES NOT work at present. I will create this once the interface is complete.</li>
</ul>
<div>Watch out for a flickr style app that will allow users to upload a photo with a location and see this on a map!!</div>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.sizzla-media.co.uk/2008/03/28/flashgooglemaps-mashup/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.295 seconds -->
