<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: How can I move a map saved on Google Earth (.kml file) to a website using the Google Maps API?</title>
	<link>http://ask.metafilter.com/28631/How-can-I-move-a-map-saved-on-Google-Earth-kml-file-to-a-website-using-the-Google-Maps-API/</link>
	<description>Comments on Ask MetaFilter post How can I move a map saved on Google Earth (.kml file) to a website using the Google Maps API?</description>
	<pubDate>Wed, 07 Dec 2005 16:13:01 -0800</pubDate>
	<lastBuildDate>Wed, 07 Dec 2005 16:13:01 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: How can I move a map saved on Google Earth (.kml file) to a website using the Google Maps API?</title>
		<link>http://ask.metafilter.com/28631/How-can-I-move-a-map-saved-on-Google-Earth-kml-file-to-a-website-using-the-Google-Maps-API</link>	
		<description>How can I export a map from Google Earth to a website using the Google Maps API? &lt;br /&gt;&lt;br /&gt; I&apos;ve plotted my worldly travels in GoogleEarth and would like to do the same on a website using Google Maps.  I figure saving as KML is a good start, but I&apos;m not sure what the next step is.  Thanks for the help!</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2005:site.28631</guid>
		<pubDate>Wed, 07 Dec 2005 15:14:41 -0800</pubDate>
		<dc:creator>JudgeBork</dc:creator>
		
			<category>googleearth</category>
		
			<category>googlemaps</category>
		
			<category>googlelocal</category>
		
			<category>kml</category>
		
			<category>kmz</category>
		
			<category>export</category>
		
	</item> <item>
		<title>By: Civil_Disobedient</title>
		<link>http://ask.metafilter.com/28631/How-can-I-move-a-map-saved-on-Google-Earth-kml-file-to-a-website-using-the-Google-Maps-API#450460</link>	
		<description>First you&apos;ll need a  &lt;a href=&quot;http://www.google.com/apis/maps/signup.html&quot;&gt;GoogleMaps developer&apos;s license&lt;/a&gt; to link to their API script in your web page.  The actual format for generating a map is very, very simple.  Basically a bunch of x-y coordinate tags.  If you can export those from Google Earth, you&apos;re golden.&lt;br&gt;
&lt;br&gt;
The basic code for generating the map is located inside the body.onload function:&lt;br&gt;
&lt;br&gt;
function onLoad() {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;var map = new GMap(document.getElementById(&quot;map&quot;));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;map.addControl(new GLargeMapControl());&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;map.centerAndZoom(new GPoint(2.308588,48.873804), 3);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;map.setMapType( _SATELLITE_TYPE );&lt;br&gt;
&lt;br&gt;
The first line creates the map in the DIV holder called &quot;map&quot;.  The second line adds the zoom controls.  The third line is where the map is centered (longitude and latitude) and how much it&apos;s zoomed in (level 3).  The fourth line tells the map to start with the satellite map.  You can change these to whatever you like.  Check out the &lt;a href=&quot;http://www.google.com/apis/maps/documentation/&quot;&gt;full Google Maps documentation&lt;/a&gt; for more information.&lt;br&gt;
&lt;br&gt;
To create markers, use this function:&lt;br&gt;
function createMarker(point, marktext) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;var marker = new GMarker(point);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;var html = marktext;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;GEvent.addListener(marker, &quot;click&quot;, function() {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;marker.openInfoWindowHtml(html);&lt;br&gt;
        });&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;return marker;&lt;br&gt;
      }&lt;br&gt;
&lt;br&gt;
Now you just need to load up all your points:&lt;br&gt;
&lt;br&gt;
var markers = [];&lt;br&gt;
var points = [];&lt;br&gt;
points.push(new GPoint( 2.271252,48.869450));&lt;br&gt;
points.push(new GPoint( 2.274277,48.871229));&lt;br&gt;
points.push(new GPoint( 2.275103,48.871102));&lt;br&gt;
&lt;br&gt;
markers.push(createMarker(points[0], &quot;First point&quot;));&lt;br&gt;
markers.push(createMarker(points[1], &quot;Second point&quot;));&lt;br&gt;
markers.push(createMarker(points[2], &quot;Third point&quot;));&lt;br&gt;
&lt;br&gt;
Finally, add the markers as overlays to the map:&lt;br&gt;
&lt;br&gt;
for (x=0; x &lt; markers.length; x++) {br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;map.addOverlay(markers[x]);&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
Then, just place somewhere inside the BODY part of your html a div called &apos;map&apos; (you can call it whatever you like, of course).&lt;br&gt;
&lt;br&gt;
&amp;lt;div id=&quot;map&quot; style=&quot;width:600px; height: 500px;&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br&gt;
&lt;br&gt;
You can view the HTML source code in my &lt;a href=&quot;http://www.renegadetourist.com/rendezvous.html&quot;&gt;&quot;rendezvous&quot; map&lt;/a&gt; for a simple example.&lt;/&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.28631-450460</guid>
		<pubDate>Wed, 07 Dec 2005 16:13:01 -0800</pubDate>
		<dc:creator>Civil_Disobedient</dc:creator>
	</item><item>
		<title>By: Civil_Disobedient</title>
		<link>http://ask.metafilter.com/28631/How-can-I-move-a-map-saved-on-Google-Earth-kml-file-to-a-website-using-the-Google-Maps-API#450461</link>	
		<description>Argh, looks like that last procedure got screwed up:&lt;br&gt;
&lt;br&gt;
for (x=0; x &lt; markers.length; x++) {br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;map.addOverlay(markers[x]);&lt;br&gt;
}&lt;/&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.28631-450461</guid>
		<pubDate>Wed, 07 Dec 2005 16:14:06 -0800</pubDate>
		<dc:creator>Civil_Disobedient</dc:creator>
	</item><item>
		<title>By: Civil_Disobedient</title>
		<link>http://ask.metafilter.com/28631/How-can-I-move-a-map-saved-on-Google-Earth-kml-file-to-a-website-using-the-Google-Maps-API#450462</link>	
		<description>DAMMIT.  Just forget the &quot;br&amp;gt;&quot; part.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.28631-450462</guid>
		<pubDate>Wed, 07 Dec 2005 16:14:24 -0800</pubDate>
		<dc:creator>Civil_Disobedient</dc:creator>
	</item><item>
		<title>By: Civil_Disobedient</title>
		<link>http://ask.metafilter.com/28631/How-can-I-move-a-map-saved-on-Google-Earth-kml-file-to-a-website-using-the-Google-Maps-API#450476</link>	
		<description>Took a quick look at the KML file format.  It&apos;s basic XML node structure, with the placemarks&apos; longitude and latitude enclosed in the &lt;point&gt; &lt; / point&gt; tags.  Go through the KML file and cut the POINTS coordinates and paste them into the structure I provided above (the &quot;new Gpoint&quot; part) and it should work fine.&lt;/point&gt;&lt;/&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.28631-450476</guid>
		<pubDate>Wed, 07 Dec 2005 16:27:38 -0800</pubDate>
		<dc:creator>Civil_Disobedient</dc:creator>
	</item><item>
		<title>By: Civil_Disobedient</title>
		<link>http://ask.metafilter.com/28631/How-can-I-move-a-map-saved-on-Google-Earth-kml-file-to-a-website-using-the-Google-Maps-API#450480</link>	
		<description>If you wanted to get extra-fancy, you could write a script that combed through the KML file automatically for the points and automatically inserted them into the array.&lt;br&gt;
&lt;br&gt;
If this all sounds like gobldygook to you, let me know.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.28631-450480</guid>
		<pubDate>Wed, 07 Dec 2005 16:29:29 -0800</pubDate>
		<dc:creator>Civil_Disobedient</dc:creator>
	</item><item>
		<title>By: scruss</title>
		<link>http://ask.metafilter.com/28631/How-can-I-move-a-map-saved-on-Google-Earth-kml-file-to-a-website-using-the-Google-Maps-API#450596</link>	
		<description>You could transform your KML to &lt;a href=&quot;http://www.topografix.com/gpx.asp&quot;&gt;GPX&lt;/a&gt;, then use the &lt;a href=&quot;http://www.tom-carden.co.uk/googlegpx/&quot;&gt;Google Maps GPX viewer&lt;/a&gt;.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.28631-450596</guid>
		<pubDate>Wed, 07 Dec 2005 18:38:49 -0800</pubDate>
		<dc:creator>scruss</dc:creator>
	</item>
	</channel>
</rss>
