<?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>techrageo.us &#187; Mapping</title>
	<atom:link href="http://techrageo.us/taxonomy/categories/mapping/feed/" rel="self" type="application/rss+xml" />
	<link>http://techrageo.us</link>
	<description>insight on technology</description>
	<lastBuildDate>Sat, 22 Oct 2011 12:18:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Google Maps for WordPress &#8211; GooMaps</title>
		<link>http://techrageo.us/2005/08/16/google-maps-api-and-wordpress/</link>
		<comments>http://techrageo.us/2005/08/16/google-maps-api-and-wordpress/#comments</comments>
		<pubDate>Tue, 16 Aug 2005 15:13:12 +0000</pubDate>
		<dc:creator>bill</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mapping]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://techrageo.us/?p=42</guid>
		<description><![CDATA[Google Maps Update (8 Mar 2009): Updated again to fix the constants broken by a change made by Google. Thanks to brian, who left a comment asking about the maps not working. Update (30 Jan 2007): Updated again to make a link in the popup actually open a new window. Did this by embedding a [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Google Maps</strong></p>
<p><em>Update (8 Mar 2009):  Updated again to fix the constants broken by a change made by Google. Thanks to brian, who left a comment asking about the maps not working.</em></p>
<p><em>Update (30 Jan 2007):  Updated again to make a link in the popup actually open a new window. Did this by embedding a javascript OnClick handler in the html attribute of the marker element in the xml file.</em></p>
<p><em>Update (6 Sept 2005): I&#8217;ve updated the XML file goomap1.xml again, this time to include a link around &#8216;IBM&#8217;. Note that the anchor tag must specify a target so the link doesn&#8217;t open inside the IFRAME, and of course angle-brackets must again be XML encoded.</em></p>
<p><em>Update (1 Sept 2005): I&#8217;ve updated the XML file goomap1.xml to include a break (&lt;br/&gt;) between IBM and Dev in the info popup HTML. It must be XML encoded to obscure the angle-brackets from the XML parser.</em></p>
<p>Sites like <a href="http://www.mapquest.com">MapQuest</a> and <a href="http://www.mapblast.com">MapBlast</a> served our mapping needs first, but <a href="http://maps.google.com">Google Maps</a> started the second revolution in online mapping. Click and drag to pan  in realtime. Zoom in and out just as quickly. Click a button to get satellite  imagery instead of a map. Now they offer a hybrid mode with streets and labels  overlaid on top of the satellite imagery. It&#8217;s all very cool.</p>
<p>Google Maps has <a href="http://www.google.com/apis/maps/">a mapping API</a> with which you can build and use your own maps, complete  with custom markers, animation, popup information bubbles, and the works.</p>
<p>So to build maps you simply sign up for a <a href="http://www.google.com/apis/maps/signup.html">Google Maps API Key</a>, reference a Google-provided script in the HTML head element, and embed a div and some simple Javascript in your HTML, and you&#8217;re off to the races.</p>
<p><strong>Google Maps and WordPress</strong></p>
<p>Of course, it&#8217;d occasionally be nice to embed a custom Google Map in a WordPress post. Detailing recent travel, geo-tagged photos, whatever.</p>
<p><em>Problems Embedding Google Maps in <a href="http://wordpress.org/">WordPress</a> Posts</em></p>
<p>The first problem that arises when trying to include a map within a WordPress post is this: complex inline Javascript is essentially rendered useless. But you <em>can</em> call a function. So we can offload the Javascript functionality to a file, reference it, then call the function to build the map.</p>
<p>However, a second problem shows up. Google Map API Keys are good for one directory on a  server only, so the API key would only work for the root or wp-content, or another static location.</p>
<p><em>The Solution</em></p>
<p>The solution is four-fold</p>
<ol>
<li>Move your Google Maps Javascript to a .js file, or simply download and use <a href="http://techrageo.us/wp-content/GooMaps.js"><em>GooMaps.js</em></a>.</li>
<li>Move the map data to an XML file. <a href="http://techrageo.us/wp-content/goomap1.xml"><em>goomap1.xml</em></a></li>
<li>Call the Javascript function from a standalone HTML file. <a href="http://techrageo.us/wp-content/goomap1.html"><em>goomap1.html</em></a></li>
<li>Embed the HTML file in an IFRAME within your WordPress post.</li>
</ol>
<p>&lt;br /&gt; Sorry. If you&#8217;re seeing this, your browser doesn&#8217;t support IFRAMEs. You should upgrade to a more current browser.&lt;br /&gt; Simple as that. Mostly.</p>
<p>In the example to the right, a hybrid style map is centered around IBM in Austin, TX. Two custom icons and shadows are placed on the manufacturing plant on the West side of Burnet Rd. and the development buildings across the street.</p>
<p>This was created with an IFRAME tag embedded in this post, along with uploaded XML and HTML files, goomap1.xml and goomap1.html, to describe the map data and the IFRAME HTML, respectively. The IFRAME code also includes the Google Maps Javascript and some custom Javascript code.</p>
<p>Let&#8217;s get into those steps in more detail.</p>
<p>Step 1 &#8212; <strong>GooMaps.js &#8211; Google Maps Javascript File</strong></p>
<p>You&#8217;re going to want to put code similar to the following in a Javascript file. Let&#8217;s call it <a href="http://techrageo.us/wp-content/GooMaps.js"><em>GooMaps.js</em></a>.</p>
<p>It supports the following features:</p>
<ul>
<li>You can specify the center, the zoom, the map type (&#8220;Map&#8221;, &#8220;Satellite&#8221;, and &#8220;Hybrid&#8221;) and the base URL for icon files. Use the markers tag.</li>
<li>Include a list of markers, specifying the latitude, longitude, html caption, icon and shadow icon, and their sizes. Use the marker tag.</li>
</ul>
<p>You can <a href="http://techrageo.us/wp-content/GooMaps.js">download</a> and use this if you wish. No warrenties, use at your own risk, I&#8217;m not liable, an so on. Feel free to use it but I&#8217;d appreciate a back link.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// Function: createMarker</span>
<span style="color: #006600; font-style: italic;">// Creates a GMarker at a given point with a given icon</span>
<span style="color: #006600; font-style: italic;">//  Then adds a &quot;click&quot; event listener that pops up</span>
<span style="color: #006600; font-style: italic;">//  some caption (HTML formatted)</span>
<span style="color: #006600; font-style: italic;">// Modified from Google Maps API Reference</span>
<span style="color: #006600; font-style: italic;">// Added support for specifying icons and html captions</span>
<span style="color: #003366; font-weight: bold;">function</span> createMarker<span style="color: #009900;">&#40;</span>point<span style="color: #339933;">,</span> icon<span style="color: #339933;">,</span> html<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> marker <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> GMarker<span style="color: #009900;">&#40;</span>point<span style="color: #339933;">,</span> icon<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  GEvent.<span style="color: #660066;">addListener</span><span style="color: #009900;">&#40;</span>marker<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    marker.<span style="color: #660066;">openInfoWindowHtml</span><span style="color: #009900;">&#40;</span>html<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">return</span> marker<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #006600; font-style: italic;">// Function: GooMapXml</span>
<span style="color: #006600; font-style: italic;">// Reads an xml file, the name of which is specified</span>
<span style="color: #006600; font-style: italic;">//  in an attribute of a span with the id mapinfo.</span>
<span style="color: #003366; font-weight: bold;">function</span> GooMapXml<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">// Find mapinfo span and get name attribute</span>
  <span style="color: #003366; font-weight: bold;">var</span> mapinfo <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'mapinfo'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// Create GXmlHttp object to fetch XML document</span>
  <span style="color: #003366; font-weight: bold;">var</span> request <span style="color: #339933;">=</span> GXmlHttp.<span style="color: #660066;">create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// Open the connection to the XML file</span>
  request.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;GET&quot;</span><span style="color: #339933;">,</span> mapinfo<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// Describe a function to handle the completed request</span>
  request.<span style="color: #660066;">onreadystatechange</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>request.<span style="color: #660066;">readyState</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">// Get XML file contents</span>
      <span style="color: #003366; font-weight: bold;">var</span> xmlDoc <span style="color: #339933;">=</span> request.<span style="color: #660066;">responseXML</span><span style="color: #339933;">;</span>
      <span style="color: #006600; font-style: italic;">// Get markers element</span>
      <span style="color: #003366; font-weight: bold;">var</span> markers <span style="color: #339933;">=</span> xmlDoc.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;markers&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #006600; font-style: italic;">// Get iconbase attribute</span>
      iconbase <span style="color: #339933;">=</span> markers<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;iconbase&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #006600; font-style: italic;">// Set default maptypes array</span>
      maptypes <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>G_SATELLITE_MAP<span style="color: #339933;">,</span>G_HYBRID_MAP<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #006600; font-style: italic;">// If maptype attribute is present get it and set accordingly</span>
      <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> markers<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;maptype&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        mt <span style="color: #339933;">=</span> markers<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;maptype&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toUpperCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">switch</span><span style="color: #009900;">&#40;</span> mt <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
          <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">&quot;SAT&quot;</span> <span style="color: #339933;">:</span>
            maptypes <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>G_SATELLITE_MAP<span style="color: #339933;">,</span>G_HYBRID_MAP<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
          <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">&quot;HYB&quot;</span> <span style="color: #339933;">:</span>
            maptypes <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>G_HYBRID_MAP<span style="color: #339933;">,</span>G_SATELLITE_MAP<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #006600; font-style: italic;">// Get map div from HTML doc</span>
      <span style="color: #003366; font-weight: bold;">var</span> map <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> GMap<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;map&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>maptypes<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #006600; font-style: italic;">// Add small google map controls</span>
      map.<span style="color: #660066;">addControl</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> GSmallMapControl<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #006600; font-style: italic;">// Add map type buttons</span>
      map.<span style="color: #660066;">addControl</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> GMapTypeControl<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #006600; font-style: italic;">// Create point for center (get x,y from attributes of markers element)</span>
      <span style="color: #003366; font-weight: bold;">var</span> cpt <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> GPoint<span style="color: #009900;">&#40;</span>
                    parseFloat<span style="color: #009900;">&#40;</span>markers<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;centerx&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                    parseFloat<span style="color: #009900;">&#40;</span>markers<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;centery&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #006600; font-style: italic;">// Center and zoom map (zoom specified in attribute of markers element)</span>
      map.<span style="color: #660066;">centerAndZoom</span><span style="color: #009900;">&#40;</span>cpt<span style="color: #339933;">,</span> parseInt<span style="color: #009900;">&#40;</span>markers<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;zoom&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #006600; font-style: italic;">// Get marker element vector</span>
      <span style="color: #003366; font-weight: bold;">var</span> markerlist <span style="color: #339933;">=</span> xmlDoc.<span style="color: #660066;">documentElement</span>.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;marker&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #006600; font-style: italic;">// Loop through marker elements</span>
      <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> markerlist.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">// Create points based on lat, lng attributes</span>
        <span style="color: #003366; font-weight: bold;">var</span> point <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> GPoint<span style="color: #009900;">&#40;</span>
                        parseFloat<span style="color: #009900;">&#40;</span>markerlist<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;lng&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                        parseFloat<span style="color: #009900;">&#40;</span>markerlist<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;lat&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// Create icon</span>
        <span style="color: #003366; font-weight: bold;">var</span> icon <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> GIcon<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// Set image and shadow from iconbase and icon/iconsh attributes</span>
        icon.<span style="color: #660066;">image</span> <span style="color: #339933;">=</span> iconbase <span style="color: #339933;">+</span> markerlist<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;icon&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        icon.<span style="color: #660066;">shadow</span> <span style="color: #339933;">=</span> iconbase <span style="color: #339933;">+</span> markerlist<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;iconsh&quot;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #006600; font-style: italic;">// Set icon and shadow sizes from attributes</span>
        icon.<span style="color: #660066;">iconSize</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> GSize<span style="color: #009900;">&#40;</span>
          parseInt<span style="color: #009900;">&#40;</span>markerlist<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;iconszx&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
          parseInt<span style="color: #009900;">&#40;</span>markerlist<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;iconszy&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        icon.<span style="color: #660066;">shadowSize</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> GSize<span style="color: #009900;">&#40;</span>
          parseInt<span style="color: #009900;">&#40;</span>markerlist<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;iconshszx&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
          parseInt<span style="color: #009900;">&#40;</span>markerlist<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;iconshszy&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// Set icon anchor</span>
        icon.<span style="color: #660066;">iconAnchor</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> GPoint<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// Set icon window anchor</span>
        icon.<span style="color: #660066;">infoWindowAnchor</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> GPoint<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">5</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// Call createMarker w/ point, icon and html from attribute</span>
        <span style="color: #003366; font-weight: bold;">var</span> marker <span style="color: #339933;">=</span> createMarker<span style="color: #009900;">&#40;</span> point<span style="color: #339933;">,</span> icon<span style="color: #339933;">,</span>
          markerlist<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;html&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// Add marker overlay to map</span>
        map.<span style="color: #660066;">addOverlay</span><span style="color: #009900;">&#40;</span>marker<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #006600; font-style: italic;">// Send request to get XML file</span>
  request.<span style="color: #660066;">send</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Step 2 &#8212; <strong>XML Map Data</strong></p>
<p>Next, build an XML file containing enough data to describe the map.</p>
<p><em>Update #1: I&#8217;ve updated this to include a break (&lt;br/&gt;) between IBM and Dev in the info popup HTML. It must be XML encoded to obscure the angle-brackets from the XML parser.</em></p>
<p><em>Update #2: I&#8217;ve updated this to include an anchor around IBM in the info popup HTML.</em></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">&nbsp;</pre></div></div>

<p>Step 3 &#8212; <strong>HTML Google Map File</strong></p>
<p>You need a file in a static location to embed the API functions provided by Google. Otherwise you&#8217;ll get a popup complaining that your API key is for a different URL. Make sure you replace [**your api key**] in the code below with your Google Maps API Key.</p>
<p>This HTML file is simply the contents of the IFRAME you&#8217;ll be embedding in your WordPress post.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">&nbsp;
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://maps.google.com/maps?file=api&amp;amp;v=1&amp;amp;key=[**your api key**]&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:0--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://techrageo.us/wp-content/GooMap.js&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:1--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:2--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<p>Step 4 &#8212; <strong>Embedding Google Map in Your WordPress Post</strong></p>
<p>Finally, when you get to the point where you want to embed the map, simply include the following in your post.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">Sorry. If you're seeing this, your browser doesn't support IFRAMEs.
You should upgrade to a more current browser.</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://techrageo.us/2005/08/16/google-maps-api-and-wordpress/feed/</wfw:commentRss>
		<slash:comments>65</slash:comments>
		</item>
		<item>
		<title>Microsoft Virtual Earth</title>
		<link>http://techrageo.us/2005/07/26/microsoft-virtual-earth/</link>
		<comments>http://techrageo.us/2005/07/26/microsoft-virtual-earth/#comments</comments>
		<pubDate>Tue, 26 Jul 2005 11:46:43 +0000</pubDate>
		<dc:creator>bill</dc:creator>
				<category><![CDATA[Mapping]]></category>
		<category><![CDATA[Tech News]]></category>

		<guid isPermaLink="false">http://techrageo.us/?p=25</guid>
		<description><![CDATA[Microsoft is fond of saying &#8220;me too, me too!&#8221; In the beginning, we mapped with MapQuest or Yahoo Maps or their ilk. We&#8217;d enter an address and get back a zoomable, pan-able vector map. Or we&#8217;d enter &#8220;from&#8221; and &#8220;to&#8221; addresses and get back a turn-by-turn driving plan. Some of these vector mapping services had [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft is fond of saying <em>&#8220;me too, me too!&#8221;</em></p>
<p>In the beginning, we mapped with <a href="http://www.mapquest.com">MapQuest</a> or <a href="http://maps.yahoo.com">Yahoo Maps</a> or their ilk. We&#8217;d enter an address and get back a zoomable, pan-able vector map. Or we&#8217;d enter &#8220;from&#8221; and &#8220;to&#8221; addresses and get back a turn-by-turn driving plan. Some of these vector mapping services had features to show local businesses or, now and then, view satellite images of the area.</p>
<p>More recently, <a href="http://www.google.com">Google</a> outdid every generally-available mapping interface on the web with <a href="http://maps.google.com"><strong>Google Maps</strong></a>, chock-full of draggable scrolling, clever pushpins, a <a href="http://www.google.com/apis/maps/">rich API interface</a>, and of course a <em>beta</em> tag. Before long they added satellite images. (As an aside, it puzzles me why they used such old imagery. For example, I always pop in my address and check out the view from above. In Google Maps it&#8217;s a black and white lo-res image, while on the other hand, at <a href="http://www.globexplorer.com/">GlobeXplorer</a> I get a hi-res color image &#8212; not for free, of course, but my point is that better is availabe. Google has excellent hi-res color imagery of some areas and I hope they extend this coverage.) Google has also recently added a hybrid viewing mode where the satellite imagery is overlaid with roads and whatnot from the vector maps.</p>
<p>So, as things settled down and Google finished digesting the online mapping world, they released <a href="http://earth.google.com/"><strong>Google Earth</strong></a>, built on Keyhole, which they bought a while back. In its basic form, <a href="http://earth.google.com/">Google Earth</a> is free and, simply put, amazing. <a href="http://earth.google.com/earth_plus.html">Plus</a> and <a href="http://earth.google.com/earth_pro.html">Pro</a> versions are also available, for $20 and $400, respectively (the Pro price is per year). Plus adds GPS integration and annotation features, while Pro adds layers and overlays, along with the ability to pay more for additional modules (flythrough movie making, premium printing, GIS import, etc.).</p>
<p>Microsoft, already quaking in their clogs over the fact that Google is likely to buy Bill Gates before long (or more likely, build a better one), has released <a href="http://virtualearth.msn.com/">Microsoft Virtual Earth</a>. I wasn&#8217;t expecting much, but it&#8217;s not too shabby. It has a satellite view that smoothly integrates the overhead imagery with vector bit, roads, parks, labels, etc. much like Google Maps&#8217; hybrid view. I did not see a way to turn the integration off, however.</p>
<p>Micrsoft had already swallowed up <a href="http://terraserver.microsoft.com/">Terraserver</a> but this Virtual Earth, while boldly ripping off Google Maps, is a welcome addition to the mapping fray. It&#8217;s good to see this technology progressing in a publicly-available way. There&#8217;s much more that is being done with mapping in the private and government sectors, but Google Maps, Google Earth, and Microsoft Virtual Earth are leaps and bounds ahead of what we were using only a year ago.</p>
<p>Microsoft Virtual Earth seen <a href="http://www.makezine.com/blog/archive/2005/07/msn_virtual_ear_2.html ">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://techrageo.us/2005/07/26/microsoft-virtual-earth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hack Google Earth KML Files</title>
		<link>http://techrageo.us/2005/07/06/hack-google-earth-kml-files/</link>
		<comments>http://techrageo.us/2005/07/06/hack-google-earth-kml-files/#comments</comments>
		<pubDate>Wed, 06 Jul 2005 04:02:10 +0000</pubDate>
		<dc:creator>bill</dc:creator>
				<category><![CDATA[Mapping]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://techrageo.us/2005/07/06/hack-google-earth-kml-files/</guid>
		<description><![CDATA[RuiCarmo of Tao of Mac has a great tutorial on hacking Google Earth KML (Keyhole Markup Language) files in PHP. Fun stuff. Seen here. Google Earth / Keyhole is a downloadable mapping application that&#8217;s free for the downloading. Google Earth Plus is a $20 upgraded version that includes GPS integration, high-res printing, email support, annotation, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://the.taoofmac.com.nyud.net:8090/space/RuiCarmo">RuiCarmo</a> of <a href="http://the.taoofmac.com.nyud.net:8090/space">Tao of Mac</a> has <a href="http://the.taoofmac.com.nyud.net:8090/space/blog/2005-07-04">a great tutorial</a> on hacking <a href="http://earth.google.com/">Google Earth</a> <a href="http://www.keyhole.com/kml/kml_doc.html">KML</a> (Keyhole  Markup Language) files in PHP. Fun stuff. Seen <a href="http://www.makezine.com/blog/archive/2005/07/how_to_make_kml.html">here</a>.</p>
<p>Google Earth / Keyhole is a downloadable mapping application that&#8217;s <a href="http://desktop.google.com/download/earth/index.html">free for the downloading</a>. <a href="http://earth.google.com/earth_plus.html">Google Earth Plus</a> is a $20 upgraded version that includes GPS integration, high-res printing, email support, annotation, and .csv importing.</p>
<p><strong>Background &#8211; Google Earth in action</strong><br />
<img src='http://techrageo.us/wp-content/gearth01.jpg' alt='Google Earth - Austin, TX' /><br />
Google Earth</p>
<hr />
<img src='http://techrageo.us/wp-content/gearth02.jpg' alt='Google Earth - Downtown Austin, TX' /><br />
Google Earth &#8211; Downtown Austin, TX</p>
<hr />
<img src='http://techrageo.us/wp-content/gearth03.jpg' alt='Google Earth - IBM Austin' /><br />
Google Earth &#8211; IBM Austin</p>
]]></content:encoded>
			<wfw:commentRss>http://techrageo.us/2005/07/06/hack-google-earth-kml-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

