<?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>disjoint thoughts &#187; google maps</title>
	<atom:link href="http://disjointthoughts.com/category/google-maps/feed/" rel="self" type="application/rss+xml" />
	<link>http://disjointthoughts.com</link>
	<description></description>
	<lastBuildDate>Thu, 05 Aug 2010 02:35:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>a new way to embed google maps</title>
		<link>http://disjointthoughts.com/2007/08/23/a-new-way-to-embed-google-maps/</link>
		<comments>http://disjointthoughts.com/2007/08/23/a-new-way-to-embed-google-maps/#comments</comments>
		<pubDate>Thu, 23 Aug 2007 15:45:29 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[blogging]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[rock climbing]]></category>

		<guid isPermaLink="false">http://disjointthoughts.com/2007/08/23/a-new-way-to-embed-google-maps/</guid>
		<description><![CDATA[Google has announced a new way to embed google maps by providing a snippet of html that can be copy/pasted anywhere. No API key or HTML munging necessary. Just click on the &#8220;Link to this page&#8221; link, and grab the html for the map you&#8217;re viewing. Here&#8217;s an example showing the rock gym I climb [...]]]></description>
			<content:encoded><![CDATA[<p>Google has announced <a href="http://www.google.com/intl/en/press/annc/embed_maps.html" target="_new">a new way to embed google maps</a> by providing a snippet of html that can be copy/pasted anywhere. No API key or HTML munging necessary. Just click on the &#8220;Link to this page&#8221; link, and grab the html for the map you&#8217;re viewing. Here&#8217;s an example showing the rock gym I climb at:</p>
<p><iframe width="425" height="350" frameborder="no" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&#038;hl=en&#038;geocode=&#038;q=phoenix+rock+gym,+phoenix,+az&#038;ie=UTF8&#038;view=map&#038;ll=33.464098,-111.899872&#038;spn=0.125183,0.32135&#038;z=12&#038;iwloc=A&#038;om=1&#038;cid=33422005,-111916743,7712844234460509719&#038;output=embed&#038;s=AARTsJo90XFvBkQTKIaItvknBA8k9RlXPg"></iframe><br/><a href="http://maps.google.com/maps?f=q&#038;hl=en&#038;geocode=&#038;q=phoenix+rock+gym,+phoenix,+az&#038;ie=UTF8&#038;view=map&#038;ll=33.464098,-111.899872&#038;spn=0.125183,0.32135&#038;z=12&#038;iwloc=A&#038;om=1&#038;cid=33422005,-111916743,7712844234460509719&#038;source=embed" style="color:#0000FF;text-align:left;font-size:small">View Larger Map</a></p>
<p>Pretty slick!</p>
]]></content:encoded>
			<wfw:commentRss>http://disjointthoughts.com/2007/08/23/a-new-way-to-embed-google-maps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>example of using hpricot, rexml, and kml</title>
		<link>http://disjointthoughts.com/2007/08/16/example-of-using-hpricot-rexml-and-kml/</link>
		<comments>http://disjointthoughts.com/2007/08/16/example-of-using-hpricot-rexml-and-kml/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 17:39:54 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[google maps]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[the great outdoors]]></category>

		<guid isPermaLink="false">http://disjointthoughts.com/2007/08/16/example-of-using-hpricot-rexml-and-kml/</guid>
		<description><![CDATA[I wrote a little Ruby script to parse some hot spring data and throw it into a kml file for display in google maps or google earth (here&#8217;s the results). It doesn&#8217;t do anything too complex, but it makes for a decent example of using hpricot to parse html and rexml to generate kml. Here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a little Ruby script to parse some <a href="http://www.hotspringsenthusiast.com/TextLinks.asp" target="_new">hot spring data</a> and throw it into a <a href="http://code.google.com/apis/kml/documentation/" target="_new">kml file</a> for display in google maps or google earth (<a href="http://disjointthoughts.com/hot-spring-maps/" target="_new">here&#8217;s the results</a>). It doesn&#8217;t do anything too complex, but it makes for a decent example of using <a href="http://code.whytheluckystiff.net/hpricot/" target="_new">hpricot</a> to parse html and <a href="http://www.germane-software.com/software/rexml/" target="_new">rexml</a> to generate kml. Here&#8217;s the source if anyone would like to take a look:</p>
<pre style="width:500px;height:400px;border:solid 1px #ccc;overflow:scroll;">
#written by Benjamin Smith
#www.disjointthoughts.com
#benjamin.lee.smith@gmail.com

require 'hpricot'
require 'open-uri'
require 'rexml/document'
require 'erb'

#arg: url to parse from http://www.hotspringsenthusiast.com/TextLinks.asp
#doesnt work for arkansas, georgia, new york, north carolina, south dakota, virgina
url = ARGV[0]

#parse name of state out of url
state = url[url.index('.com')+5..url.length-5]

#grab the html
doc = Hpricot(open(url))

#create xml for the kml file
xml = REXML::Document.new
kml = xml.add_element 'kml', {'xmlns' => 'http://earth.google.com/kml/2.1'}
kml_doc = kml.add_element 'Document'

#add the name of the state to the xml
(kml_doc.add_element 'name').text = "#{state} Hot Springs"

#add reference to me
(kml_doc.add_element 'description').text = 'created by Benjamin Smith http://www.disjointthoughts.com'
doc_folder = kml_doc.add_element 'Folder'

#add reference to the data source
(doc_folder.add_element 'name').text = 'http://www.hotspringsenthusiast.com/'
(doc_folder.add_element 'description').text = "data source #{url}"

#iterate over the rows in the table
doc.search('//tr').each do |tr|
  tds = tr.search('//td')
  if tds.first.inner_html != 'STATE'
    link = tds[3].search('//a').to_s
    lat = link[link.index('lat=')+4..link.index('&#038;',link.index('lat='))-1]
    lon = link[link.index('lon=')+4..link.index('"',link.index('lon='))-1].gsub('E','')
    topo = link[link.index('href="')+6..link.index('"',link.index('href="')+7)-1] 

    placemark = doc_folder.add_element 'Placemark'
    (placemark.add_element('name')).text = tds[3].search('//a').inner_html.to_s.gsub("\r\n",'').squeeze.downcase
    (placemark.add_element('description')).text = REXML::CData.new('Temperature: '+tds[4].inner_html+'F/'+tds[5].inner_html+'C&lt;br/>&lt;a href="'+topo+'">Topo</a>')
    point = placemark.add_element 'Point'
    (point.add_element 'coordinates').text = "#{lon.to_s},#{lat.to_s}"
  end
end

f = File.new("#{state.downcase}.kml",'w')
f.write('<?xml version="1.0" encoding="UTF-8"?>'+"\n")
xml.write(f,4)
f.close

#create html file to display kml in google map
erb = ERB.new(File.read('template_hot_springs.erb'))
f = File.new("#{state.downcase}_hot_springs.html",'w')
f.write(erb.result(binding))
f.close
</pre>
<p>If you&#8217;d like to run it on your own, you can <a href="http://disjointthoughts.com/static_blog_files/hotsprings/converter.rb" target="_new">download it here</a>. You&#8217;ll also need <a href="http://disjointthoughts.com/static_blog_files/hotsprings/template_hot_springs.erb" target="_new">this template file</a> and <a href="http://disjointthoughts.com/static_blog_files/hotsprings/map.css" target="_new">this css file</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://disjointthoughts.com/2007/08/16/example-of-using-hpricot-rexml-and-kml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>missing descriptions from kml google map</title>
		<link>http://disjointthoughts.com/2007/06/01/missing-descriptions-from-kml-google-map/</link>
		<comments>http://disjointthoughts.com/2007/06/01/missing-descriptions-from-kml-google-map/#comments</comments>
		<pubDate>Sat, 02 Jun 2007 00:16:40 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[google maps]]></category>

		<guid isPermaLink="false">http://disjointthoughts.com/?p=167</guid>
		<description><![CDATA[A few weeks ago I posted a google map I had made of Arizona hot springs. However I had some issues with the map. The map was created using a kml file loaded into an html page using some google javascript magic: var geoXml = new GGeoXml("http://www.disjointthoughts.com/static_blog_files/arizona.kml"); Everything loaded up and looked fine until I [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I posted a <a href="http://disjointthoughts.com/?p=161" target="new">google map I had made of Arizona hot springs</a>. However I had some issues with the map.</p>
<p>The map was created using a kml file loaded into an html page using some google javascript magic:</p>
<p><code><br />
var geoXml = new GGeoXml("http://www.disjointthoughts.com/static_blog_files/arizona.kml");<br />
</code></p>
<p>Everything loaded up and looked fine until I tried to click on one of the markers/pins. When I clicked on the markers, the bubble which appeared over the it was blank instead of containing the description: name of the hot spring along with a link to a topo. To make things more confusing, this behavior didn&#8217;t happen when loading the kml in google earth.</p>
<p>Since the kml file worked fine in google earth, I assumed the kml file was ok. The HTML I was using to render the map in a web browser was a copied/pasted example from google&#8217;s documentation, so I assumed that was ok as well. After some searching around I found <a href="http://groups.google.com.my/group/Google-Maps-API/browse_thread/thread/25086c97113d453e/0503f10f42190e33?#0503f10f42190e33" target="new">this thread</a> describing my exact problem. Turns out google&#8217;s documentation was a bit outdated. The javascript include for google map api needs to be updated from &#8220;v=2&#8243; to &#8220;v=2.x&#8221;:</p>
<p><code>&lt;script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=your-google-map-key" type="text/javascript">&lt;/script></code></p>
<p>This cured my problem. Now I have a lovely, marker clickable, <a href="http://www.disjointthoughts.com/static_blog_files/arizona_hot_springs_big.html" target="new">map of the hot springs of arizona</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://disjointthoughts.com/2007/06/01/missing-descriptions-from-kml-google-map/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
