<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Google API Help</title>
    <link rel="alternate" type="text/html" href="http://www.googleapihelp.com/" />
    <link rel="self" type="application/atom+xml" href="http://www.googleapihelp.com/atom.xml" />
    <id>tag:www.googleapihelp.com,2009-07-27:/39</id>
    <updated>2010-02-23T17:25:30Z</updated>
    <subtitle>Plot points using Maps, awesome AJAX, cool visualizations, helpful languages and more!</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.25</generator>

<entry>
    <title>Displaying Maps Without The API</title>
    <link rel="alternate" type="text/html" href="http://www.googleapihelp.com/2010/02/displaying-maps-without-the-api.html" />
    <id>tag:www.googleapihelp.com,2010://39.913</id>

    <published>2010-02-23T17:10:28Z</published>
    <updated>2010-02-23T17:25:30Z</updated>

    <summary>Google&apos;s Map API is great for displaying a map on your web site. However sometimes there is an even easier way. I recently helped PageTronics Wireless with a new blog. They wanted a map on the blog that showed their...</summary>
    <author>
        <name>Tom Fitzgerald</name>
        <uri>http://www.optilaw.com</uri>
    </author>
    
    <category term="api" label="api" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="maps" label="maps" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-us" xml:base="http://www.googleapihelp.com/">
        <![CDATA[Google's Map API is great for displaying a map on your web site. However sometimes there is an even easier way. I recently helped <a href="http://www.pagetronics.com/blog">PageTronics Wireless</a> with a new blog. They wanted a map on the blog that showed their 4 store locations. Normally I would do this using the Google Map API but today I wanted to show another way that is a little easier.<div><br /></div><div><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><img alt="google-maps-ppc.gif" src="http://www.googleapihelp.com/images/google-maps-ppc.gif" width="473" height="357" class="mt-image-center" style="text-align: center; display: block; margin: 0 auto 20px;" /></span></div><div><br /></div>]]>
        <![CDATA[<div>Go to Google Maps - <a href="http://maps.google.com">maps.google.com</a></div><div><br /></div><div>Click on My Maps, then Create New Map. You'll have the chance to give it a title and a description.</div><div><br /></div><div><span class="mt-enclosure mt-enclosure-image" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; display: inline; "><img alt="google-maps-blog.jpg" src="http://www.googleapihelp.com/images/google-maps-blog.jpg" width="380" height="371" class="mt-image-none" /></span></div><div><span class="mt-enclosure mt-enclosure-image" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; display: inline; "><br /></span></div><div><span class="mt-enclosure mt-enclosure-image" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; display: inline; ">Then using the blue map marker you can select points on the map. Once you click on the map you can select text to be placed into each bubble.</span></div><div><br /></div><div><span class="mt-enclosure mt-enclosure-image" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; display: inline; "><img alt="google-maps-blog-2.jpg" src="http://www.googleapihelp.com/images/google-maps-blog-2.jpg" width="380" height="371" class="mt-image-none" /></span></div><div><span class="mt-enclosure mt-enclosure-image" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; display: inline; "><br /></span></div><div><span class="mt-enclosure mt-enclosure-image" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; display: inline; ">Once you have your places in the map, click on the Link text in the upper right hand corner then&nbsp;Customize and preview embedded map. You will be given many options to customize the map further. Then by copying and pasting the code you can add to your web site or blog.&nbsp;</span></div><div><span class="mt-enclosure mt-enclosure-image" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; display: inline; "><br /></span></div><div><span class="mt-enclosure mt-enclosure-image" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; display: inline; ">To see the final result check a look at <a href="http://www.pagetronics.com/blog">PageTronics Wireless's Blog</a>.</span></div>]]>
    </content>
</entry>

<entry>
    <title>Click on Map listener</title>
    <link rel="alternate" type="text/html" href="http://www.googleapihelp.com/2009/11/click-on-map-listener.html" />
    <id>tag:www.googleapihelp.com,2009://39.496</id>

    <published>2009-11-09T17:23:09Z</published>
    <updated>2009-11-09T17:29:17Z</updated>

    <summary>Today I wanted to share a quick example. You want a specific function to happen when someone clicks on your map. We&apos;re not talking about click on a marker to open a info window. Today I&apos;m assuming you want to...</summary>
    <author>
        <name>Tom Fitzgerald</name>
        <uri>http://www.optilaw.com</uri>
    </author>
    
        <category term="Maps API" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="clickonmaplistener" label="Click on Map listener" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-us" xml:base="http://www.googleapihelp.com/">
        <![CDATA[Today I wanted to share a quick example. You want a specific function to happen when someone clicks on your map. We're not talking about click on a marker to open a info window. Today I'm assuming you want to redirect someone to another page when they click on the map.&nbsp;<div><br /></div><div>To do this we create a listener, it's really easy and will take 40 seconds to explain.</div>]]>
        <![CDATA[Here is the code that makes it all happen<div class="code">map = new GMap2(document.getElementById("map_canvas"));<br />GEvent.addListener(map, "click", function() {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;top.location = 'http://www.queenannessheriff.org/';<br/>);</div><div><span class="Apple-style-span" style="background-color: rgb(255, 255, 255);"></span></div><br /><div>You can see the map object is created. Then we use GEvent to call 'addListener'. We say when someone 'clicks' on the 'map' to execute the following. Then we tell the page to load http://www.queenannessheriff.org. Easy enough.&nbsp;</div><div><br /></div><div>In this case this was a mini map used to show an example of the map. I wanted the user to click on the map to load the full version.&nbsp;</div>]]>
    </content>
</entry>

<entry>
    <title>Prediction : Google Music API</title>
    <link rel="alternate" type="text/html" href="http://www.googleapihelp.com/2009/10/prediction-google-music-api.html" />
    <id>tag:www.googleapihelp.com,2009://39.466</id>

    <published>2009-10-22T11:46:32Z</published>
    <updated>2009-10-22T11:52:44Z</updated>

    <summary>Ok this may be kinda obvious of a prediction but I think one day we&apos;ll have some sort of Google Music API. Today I just read that Google is coming out with a music search. Makes sense. They index and...</summary>
    <author>
        <name>Tom Fitzgerald</name>
        <uri>http://www.optilaw.com</uri>
    </author>
    
        <category term="General Information" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="api" label="api" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="google" label="Google" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="music" label="music" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-us" xml:base="http://www.googleapihelp.com/">
        <![CDATA[Ok this may be kinda obvious of a prediction but I think one day we'll have some sort of Google Music API. Today I just read that Google is coming out with a music search. Makes sense. They index and provide search for just about everything else. The original article is located <a href="http://www.hollywoodreporter.com/hr/content_display/technology/news/e3i209e6b1f462c1a5817d94f32a4eb8576">here</a>. I found it interesting that each artist will get their own page similar to how each company gets their own page on Google Finance.&nbsp;<div><br /></div><div>The end goal of course being to sell music, thats right - a direct threat against Apple's iTunes. I for one absolutely love this idea. Competition breeds excellence. iTunes sucks, I'm sorry but it's true. I don't love the interface and adding new songs is just a plain and I could go on and on. A lot of times friends will ask me to help with them with some iTunes problem. Every time I just cringe. One would have to hope that Google's alternative will be better and cheaper.&nbsp;</div><div><br /></div><div>I also found this to be very interesting, taken from the original article:</div><div><br /></div><div><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, Arial, sans-serif; font-size: 12px; "><i>"Although Google won't get a share of song sales, it will collect revenue from advertising that will be shown with the search results, according to the people familiar with the plans"</i></span></div><div><br /></div><div>Hmm, so Google won't be making money on the song sales themselves. That's interesting. So that means the original site will get the money, possibly offering referral money for&nbsp;affiliates? The whole thing sounds good.&nbsp;</div><div><br /></div><div>Anyway, somehow out of all this I predict some sort of API that will allow us to tap into this Google music goodness. Heres hoping!</div>]]>
        
    </content>
</entry>

<entry>
    <title>JSON to Map</title>
    <link rel="alternate" type="text/html" href="http://www.googleapihelp.com/2009/08/json-to-map.html" />
    <id>tag:www.googleapihelp.com,2009://39.339</id>

    <published>2009-08-11T16:08:39Z</published>
    <updated>2009-08-11T16:25:21Z</updated>

    <summary> Today we are going to load JSON data thats being served from our Ruby on Rails scaffold. For this lesson I&apos;ll just concentrate on reading from JSON and display it on the map. In another lesson we&apos;ll show how...</summary>
    <author>
        <name>Tom Fitzgerald</name>
        <uri>http://www.optilaw.com</uri>
    </author>
    
        <category term="Maps API" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="javascript" label="javascript" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="jquery" label="jquery" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="json" label="JSON" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="map" label="map" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-us" xml:base="http://www.googleapihelp.com/">
        <![CDATA[ <p>Today we are going to load JSON data thats being served from our Ruby on Rails scaffold. For this lesson I'll just concentrate on reading from JSON and display it on the map. In another lesson we'll show how to setup the scaffold. Then we'll go over how to make the markers and client list clickable. For an example on what this will look like, visit   <a href="http://www.ccexperts.com/dev/json-map.html">http://www.ccexperts.com/dev/json-map.html</a> or view the image below.</p><p></p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.googleapihelp.com/2009/08/json-to-map.html"><img alt="json-to-map.jpg" src="http://www.googleapihelp.com/images/json-to-map.jpg" width="500" height="268" class="mt-image-none" style="" border="0" /></a></span><p></p><div><br /></div>]]>
        <![CDATA[<h2>Let's dig into the code!</h2>
<div class="code">
  <p>&lt;script src="http://www.google.com/jsapi?key=PUTYOURAPIKEYHERE" type="text/javascript"&gt;&lt;/script&gt;<br />
  &lt;script type="text/javascript"&gt; </p>
    <span class="note">Note here we load the library API not the map API. This allows us to load whatever libraries we need. In this case we load jQuery and the Maps API.</span>
  <p>google.load("jquery", "1.3.2");<br />
  google.load("maps", "2");</p>
    <span class="note">This function is called after the page fully loads and the Google API's are loaded. It starts out by building a simple map</span>
  <p>function loaded(){ <br />
    var map = new GMap(document.getElementById("map"));<br />
    map.addControl(new GLargeMapControl());<br />
    map.addControl(new GMapTypeControl());<br />
    map.setCenter(new GLatLng( 39.17165,-76.619951),9);<br />
    <span class="note">Now the map is loaded we use jQuery's getJSON function to call our Ruby scaffold. It's important to add the ?callback=? argument. If we didn't do this it would not work - more on that another time.</span>
    $.getJSON("http://www.ccexperts.com:3000/clients?callback=?", <br />
    function(data){<br />
    $.each(data, function(i,item){<br />
    <span class="note">We loop over every client.</span>
    $.each(item, function(j,small){<br />
    <span class="note">Read the lat and lng info and make a new point. Then plot that point on the map.</span>
    var point = new GLatLng(small.lat,small.lng); <br />
    marker = new GMarker(point);<br />
    map.addOverlay(marker);<br />
    <span class="note">Now we use jQuery create a &lt;LI&gt; element for every client that contains the client name. We put this list inside the info &lt;div&gt; I already created.</span>
    $("&lt;li/&gt;").html(small.firmname).appendTo("#info");<br />
    });<br />
    });<br />
    });<br />
    }<br />
    <span class="note">This tells us to call our loaded function when everything is up.</span>
    google.setOnLoadCallback(loaded); <br />
  &lt;/script&gt; </p>
</div>
<h2>Easy enough!</h2>
<p>As you can see it's pretty straight forward. I left plenty of room to expand on this later such as making the client list clickable to open info windows. </p>]]>
    </content>
</entry>

<entry>
    <title>Google Weather API</title>
    <link rel="alternate" type="text/html" href="http://www.googleapihelp.com/2009/08/google-weather-api.html" />
    <id>tag:www.googleapihelp.com,2009://39.256</id>

    <published>2009-08-02T12:58:22Z</published>
    <updated>2009-08-02T13:07:37Z</updated>

    <summary>Every web designer has at one point or another been asked, &quot;How can I get weather on my site?&quot; The old answer was to have a giant ugly weather channel gadget. Something that looked very nasty and you couldn&apos;t un-brand...</summary>
    <author>
        <name>Tom Fitzgerald</name>
        <uri>http://www.optilaw.com</uri>
    </author>
    
        <category term="Webmaster Gadgets" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="api" label="api" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="weatherapi" label="weather api" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-us" xml:base="http://www.googleapihelp.com/">
        <![CDATA[<p>Every web designer has at one point or another been asked, "How can I get weather on my site?" The old answer was to have a giant ugly weather channel gadget. Something that looked very nasty and you couldn't un-brand it no matter what. Some used an iframe to display external data and have it appear to be on their site. Lastly you could always just have a link that says 'click here for weather'. My goal was to get weather data from an external source and be able to customize how it looks. Fortunately now there are some great resources out there. I'm going with one that is my favorite, something extremely easy to use and customize - Google's Weather API.<br /></p><div style="text-align: center;"><a href="http://www.googleapihelp.com/2009/08/google-weather-api.html#more"><img alt="weather-icons.jpg" src="http://www.googleapihelp.com/images/weather-icons.jpg" width="450" height="47" class="mt-image-none" style="" border="0"/></a></div><p></p> ]]>
        <![CDATA[<p>To start lets pull up the URL in your browser.</p>
<div class="code">http://www.google.com/ig/api?weather=new+york,ny</div>
<p>If you look in the address you can see the location - New York, NY. Easy enough, let's take a look at the output.</p>
<h2>Weather XML Output</h2>
<div class="code">
  <p>&lt;xml_api_reply version="1"&gt;<br />
  &lt;weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0" &gt;<br />
  &lt;forecast_information&gt;<br />
  &lt;city data="New York, NY"/&gt;<br />
  &lt;postal_code data="new york,ny"/&gt;<br />
  &lt;latitude_e6 data=" "/&gt;<br />
  &lt;longitude_e6 data=" "/&gt;<br />
  &lt;forecast_date data="2009-08-02"/&gt;<br />
  &lt;current_date_time data="2009-08-02 12:19:00 +0000"/&gt;<br />
  &lt;unit_system data="US"/&gt;<br />
  &lt;/forecast_information&gt;</p>
  <blockquote>
    <p><strong>&lt;current_conditions&gt;<br />
      &lt;condition data="Light rain"/&gt;<br />
      &lt;temp_f data="72"/&gt;<br />
      &lt;temp_c data="22"/&gt;<br />
      &lt;humidity data="Humidity: 94%"/&gt;<br />
      &lt;icon data="/ig/images/weather/mist.gif"/&gt;<br />
      &lt;wind_condition data="Wind: N at 6 mph"/&gt;<br />
      &lt;/current_conditions&gt;</strong></p>
  </blockquote>
  <p>&lt;/weather&gt;<br />
  &lt;/xml_api_reply&gt;</p>
</div>
<p>Wow check out how easy that was. Now all we did was submit the location and hit enter. Now we have in XML weather data for that area. No advertisements and since the data is in XML we can make it look however we want. Note: I shortened the output to only one day. So what's next? Well in my case I used a PHP script to output this data. Let's take a look at that source code.</p>
<h2>PHP Source </h2>
<div class="code">
  <p>&lt;?php </p>
  <p>function getWeather() {</p>
  <p> $requestAddress = "http://www.google.com/ig/api?weather=21619&amp;hl=en";<br />
    <strong>// Downloads weather data based on location - I used my zip code.</strong><br />
    $xml_str = file_get_contents($requestAddress,0);<br />
    // Parses XML <br />
    $xml = new SimplexmlElement($xml_str);<br />
    // Loops XML<br />
    $count = 0;<br />
  echo '&lt;div id="weather"&gt;';</p>
  <blockquote>
    <p> foreach($xml-&gt;weather as $item) {</p>
    <blockquote>
      <p> foreach($item-&gt;forecast_conditions as $new) {</p>
      <blockquote>
        <p> echo '&lt;div class="weatherIcon"&gt;';<br />
          echo '&lt;img src="http://www.google.com/' .$new-&gt;icon['data'] . '"/&gt;&lt;br/&gt;';<br />
          echo $new-&gt;day_of_week['data'];<br />
          echo '&lt;/div&gt;';<br />
          }<br />
        </p>
      </blockquote>
    </blockquote>
    <p> }</p>
  </blockquote>
  <p> echo '&lt;/div&gt;';<br />
    }<br />
    <br />
    getWeather();</p>
  <p>?&gt;</p>
</div>
I hope this tutorial was helpful! The Weather API is great on so many levels, fast, easy and customizable. To see this live take a look at <a href="http://www.jettydockbar.com" target="_blank">Jetty Dock Bar's</a> web site where it was used.<div><h2>Download Source Files</h2></div><div><ul><li><a href="http://www.ccexperts.com/dev/weather.txt">Download weather.php</a></li></ul></div>]]>
    </content>
</entry>

<entry>
    <title>New Trends - Mashups &amp; Google Base</title>
    <link rel="alternate" type="text/html" href="http://www.googleapihelp.com/2009/07/new-trends---mashups-google-base.html" />
    <id>tag:www.googleapihelp.com,2009://39.238</id>

    <published>2009-07-27T11:48:32Z</published>
    <updated>2009-07-27T21:01:00Z</updated>

    <summary> I wanted to talk about some new trends that have been rising in popularity now. Then we&apos;ll go over how to use each of these resources to help your web site. Using these new techologies you can really add...</summary>
    <author>
        <name>Tom Fitzgerald</name>
        <uri>http://www.optilaw.com</uri>
    </author>
    
        <category term="General Information" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Google Base" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Maps API" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="api" label="api" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="base" label="base" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="google" label="google" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="maps" label="maps" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mashup" label="mashup" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-us" xml:base="http://www.googleapihelp.com/">
        <![CDATA[ <p>I wanted to talk about some new trends that have been rising in popularity now. Then we'll go over how to use each of these resources to help your web site. Using these new techologies you can really add some amazing things to your sites. Its not always easy to see how these techologies can be used to increase visits - that's what we'll be going over. So lets get started.</p><p></p>]]>
        <![CDATA[<h2 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.5em; font-weight: normal; ">Mashup Sites</h2><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Mashup Sites are sites that take 2 or more data sources and put them together to form a new site. My favorite example is Housingmaps.com. This site takes Craigs List data from their housing ads and then uses Google's Maps API to display the data. Its geniuis! Mashup sites can be really inspirational. Now more than ever there are amazing resources and APIs out there. Coming up with creative uses is both the hard and fun part.</p><h2 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.5em; font-weight: normal; ">API's</h2><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">We'll talk a lot of about API's. API's are Application Programming Interfaces in our above example the owner of housingmaps.com used Google's Maps API to display points on a map. Its a way we can talk directly to a program and use it for what we need it to do. For example anyone could go to Google Maps and search for houses for sale, however using the API we can make our own map and have things displayed exactly how we want them. Lets take a look at just a few of Google's API's (if you can't tell by now - yes I'm very partial to Google).</p><h2 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.5em; font-weight: normal; ">Google Maps</h2><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">As described in its most basic form you can have your own map and post points. We'll go into some really cool uses for this in the future.&nbsp;</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; "></p><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 20px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; list-style-type: disc; list-style-position: outside; list-style-image: initial; background-repeat: repeat-y; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Plot points on a map using Google Map API -&nbsp;<a href="http://www.googleapihelp.com/2008/11/plot-points-using-google-maps-api.html" style="text-decoration: underline; ">Part 1</a>&nbsp;-&nbsp;<a href="http://www.googleapihelp.com/2008/12/plot-points-using-google-maps-api---part-2.html" style="text-decoration: underline; ">Part 2</a></li></ul><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; "></p><h2 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.5em; font-weight: normal; ">Google Base</h2><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">This is another amazing resource.&nbsp;<a target="new" href="http://www.google.com/base" style="text-decoration: underline; ">Google Base</a>&nbsp;allows you to upload your own content - anything you want. For now we'll go over the most popular sections. Housing, Personals, Jobs, Recipes - these are all categories of Google's base. The uses for this are so incredibly large. First of all you can post your own items into Google's base. Have you ever searched on Google and it recommend Products to you? What about Google's Real Estate search? We'll go over how to add your own products and services into Google's base for all the world to see. We'll also go over how you can query Google's base and use others peoples items on your own site.</p><h2 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.5em; font-weight: normal; ">Yahoo Pipes &amp; Microsoft's Popfly</h2><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; "><a target="new" href="http://pipes.yahoo.com/pipes/" style="text-decoration: underline; ">Yahoo Pipes</a>&nbsp;&amp; Microsoft's&nbsp;<a target="new" href="http://www.popfly.com/" style="text-decoration: underline; ">Popfly</a>&nbsp;allows you to create really quick mashup sites. To take a quick example you can query Yahoo's Traffic API and place the accidents on a map. Both of these utilities are great, free and available on the web - no downloads are required.</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">We'll go over how to use all of these great resources in the future. More importantly we'll see how to not only use these resources but ways you can use these resources to help increase visits to your site.</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">I'll also go over how to do some cool stuff using Google Base. For the longest time if you wanted to search for cars, you had to go to the biggest car web site to do so. Which one to go to? cars.com? craigslist? Well now finally Google base allows anyone to add data into their database. Then anyone can pull that data and display it on their web site. Everyone adds into it - and everyone wins. I'll show you how you can query Google base to display some cool stuff on your own web site including:</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; "></p><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 20px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; list-style-type: disc; list-style-position: outside; list-style-image: initial; background-repeat: repeat-y; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Real estate listings</li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Products for sale</li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Events</li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Jobs</li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Vehicles</li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Personals</li></ul><div>There's even more than that. The idea is to have all this awesome data on YOUR web site. No more linking so the viewer can leave or using a frame. Stay tuned!</div>]]>
    </content>
</entry>

<entry>
    <title>Plot points using Google Maps API - Part 2</title>
    <link rel="alternate" type="text/html" href="http://www.googleapihelp.com/2008/12/plot-points-using-google-maps-api---part-2.html" />
    <id>tag:www.googleapihelp.com,2008://39.237</id>

    <published>2008-12-29T12:44:38Z</published>
    <updated>2009-07-31T13:49:53Z</updated>

    <summary>Hey everyone! Sorry for the delay in posting this. It&#8217;s been a busy time lately. I&#8217;m spending half my time in New York which means I&#8217;m more than double behind. Anyway I previously wrote about how to quickly geocode a...</summary>
    <author>
        <name>Tom Fitzgerald</name>
        <uri>http://www.optilaw.com</uri>
    </author>
    
        <category term="Maps API" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="api" label="api" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="displaying" label="displaying" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="javascript" label="javascript" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="map" label="map" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="php" label="php" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="plot" label="plot" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="points" label="points" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-us" xml:base="http://www.googleapihelp.com/">
        <![CDATA[<p class="MsoNormal">Hey everyone! Sorry for the delay in posting this. It&#8217;s been a busy time lately. I&#8217;m spending half my time in <st1:state w:st="on"><st1:place w:st="on">New York</st1:place></st1:state> which means I&#8217;m more than double behind. Anyway I previously wrote about how to quickly geocode a bunch of addresses using JavaScript. Then I would copy and paste those results into a new file that I named clients.xml. Warning : this is pretty inefficient I must say. If a new addresses was added you would have to go back and geocode all of them then copy and paste into clients.xml. I know this isn&#8217;t the best practice. The real answer would be to have a PHP script geocode an address and write into a database. However in the beginning I had 1000 addresses to geocode and not a lot of time to write an application. So this is really me just doing a quick&nbsp;mash up.</p>
]]>
        <![CDATA[<h2>This example I use the following method to plot my points.</h2><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; "></p><ul><li>All addresses are already geocoded in my clients.xml file - (See <a href="http://www.googleapihelp.com/2008/11/plot-points-using-google-maps-api.html">part one</a> to see how I mass geocoded the addresses to get them in there.)</li><li>Use GDownloadUrl to open clients.xml via AJAX</li><li>Loop over each entry and add to map</li></ul><p></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Ok so our clients.xml file should look something like this (I'm just posting a few lines).</p><div class="code">&lt;marker address="<st1:address w:st="on"><st1:street w:st="on"><i>123 Dundee Drive</i></st1:street><i>,&nbsp;</i><st1:city w:st="on"><i>Grasonville</i></st1:city><i>,&nbsp;</i><st1:state w:st="on"><i>MD</i></st1:state><i>&nbsp;</i><st1:postalcode w:st="on"><i>21638</i></st1:postalcode></st1:address><i>" lat="39.119173" lng="-76.614295"/&gt;<br />&lt;marker address="</i><st1:street w:st="on"><st1:address w:st="on"><i>435 Easy street</i></st1:address></st1:street><i>,&nbsp;</i><st1:place w:st="on"><st1:city w:st="on"><i>Chester</i></st1:city><i>,&nbsp;</i><st1:state w:st="on"><i>MD</i></st1:state><i>&nbsp;</i><st1:postalcode w:st="on"><i>21619</i></st1:postalcode></st1:place><i>" lat="38.951795" lng="-76.529299"/&gt;</i></div><i><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Easy enough, got the address and the cords that's all we need. Note: Again I am guilty for not putting enough information, I really should have put the persons name, etc.</p><h2>GDownloadUrl - from XML to our Map</h2><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Here is the relevant code that we'll be looking at. We use the Google function GDownloadUrl to open our XML file. The output is directly passed to the adjorning function with the variable 'doc'. We then use GXml to parse the downloaded file 'doc', that is saved as xmlDoc. We then read the elements named 'marker' which is in this case our entire file, that is saved as 'marker'.</p><div class="code">GDownloadUrl("clients.xml", function(doc) {<o:p></o:p><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; "><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>var xmlDoc = GXml.parse(doc);<o:p></o:p></pre>var markers = xmlDoc.documentElement.getElementsByTagName("marker");<br /><o:p>}</o:p></div><h2>Loop It</h2><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">We now do a loop over all the markers returned. This will loop over every address we have geocoded. You can see we use getAttribute to extract the latitude and longitude values from the markers. They are extracted then saved to point using the GLatLng function. You can see also I extract the attribute for 'html' and 'label'. In my example I never put any values into these attributes. I would recommend that you do so. You could put in the persons name or whatever information you need.</p><div class="code">for (var i = 0; i &lt; markers.length; i++) {<o:p></o:p><br />// obtain the attribues of each marker<br /><o:p></o:p>var lat = parseFloat(markers[i].getAttribute("lat"));<br /><o:p></o:p>var lng = parseFloat(markers[i].getAttribute("lng"));<br /><o:p></o:p>var point = new GLatLng(lat,lng);<br /><o:p></o:p>var html = markers[i].getAttribute("html");<br />var label = markers[i].getAttribute("label");<br /><o:p></o:p>// create the marker<br /><o:p></o:p>var marker = createMarker(point,label,html);<br /><o:p></o:p>map.addOverlay(marker);<br /><o:p></o:p>}</div><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; "><span class="Apple-style-span" style="font-style: normal;">So really that's it! The hard work of geocoding was already done in my last example, then I saved it to XML, now this map just loops over the XML file and displays it. If anyone has any questions about pretty much anything relating to Google's Map API please post a comment. In the future I'll do more tutorials and probably some videos.</span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; "><a target="new" href="http://www.club-one-fitness.com/dev/xml.html" style="text-decoration: underline; "><span class="Apple-style-span" style="font-style: normal;"><b>Here is this example live so you can see it work and view the full source.</b></span></a></p></i><p></p>
]]>
    </content>
</entry>

<entry>
    <title>Plot points using Google Maps API</title>
    <link rel="alternate" type="text/html" href="http://www.googleapihelp.com/2008/11/plot-points-using-google-maps-api.html" />
    <id>tag:www.googleapihelp.com,2008://39.236</id>

    <published>2008-11-15T12:42:01Z</published>
    <updated>2010-05-19T15:25:08Z</updated>

    <summary>In this tutorial I wanted to go over how to take raw data from just about any source and then plot the points on a Google map. This process can be done in any number of ways, I know myself...</summary>
    <author>
        <name>Tom Fitzgerald</name>
        <uri>http://www.optilaw.com</uri>
    </author>
    
        <category term="Maps API" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="api" label="api" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="map" label="map" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="plot" label="plot" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="points" label="points" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-us" xml:base="http://www.googleapihelp.com/">
        <![CDATA[<p>In this tutorial I wanted to go over how to take raw data from just about any source and then plot the points on a Google map. This process can be done in any number of ways, I know myself I have done a little differently each time - mainly due to constraints or a customers request. In this particular request I had very limited time. I was asked to take data from their client management system and then place it on a Google map. Let's see how we should start such a process.</p>]]>
        
    </content>
</entry>

</feed>
