{"id":374,"date":"2006-09-16T22:39:22","date_gmt":"2006-09-17T04:39:22","guid":{"rendered":"http:\/\/www.mooreds.com\/wordpress\/?p=374"},"modified":"2008-04-23T07:33:28","modified_gmt":"2008-04-23T13:33:28","slug":"comments-on-upgrading-to-version-two-of-google-maps","status":"publish","type":"post","link":"https:\/\/www.mooreds.com\/wordpress\/archives\/374","title":{"rendered":"Comments on upgrading to version two of Google Maps"},"content":{"rendered":"<p>I recently upgraded a simple <a href=\"http:\/\/www.mooreds.com\/writing\/xc.shtml\">simple Google Map<\/a> that I <a href=\"http:\/\/www.mooreds.com\/wordpress\/?p=322\">built last spring<\/a> to display some of the cross country skiing around Boulder.  You can see the original version <a href=\"http:\/\/www.mooreds.com\/writing\/xc-v1.shtml\"> here<\/a>.  I built this based on this <a href=\"http:\/\/www.xml.com\/pub\/a\/2005\/08\/10\/google-maps.html\">XML.com article<\/a>, using XMLHttpRequest to retrieve the data from the server and <code>Gmarker.openInfoWindoXSLT()<\/code> with <a href=\"http:\/\/www.mooreds.com\/writing\/xc.xsl\">this XSL stylesheet<\/a> to present the data.<\/p>\n<p>I decided to upgrade this map last week to version two.  Since <a href=\"http:\/\/www.google.com\/apis\/maps\/documentation\/upgrade.html#Incompatibilities\"><code>openInfoWindowXSLT<\/code> is no longer supported<\/a> on every browser, I feared that the upgrade would take significant effort, even though the map very simple.  However, the upgrade ended up being easier than I thought it would be.    To get started, I read the <a href=\"http:\/\/www.google.com\/apis\/maps\/documentation\/upgrade.html\">Google Upgrade Guide<\/a>&#8211;this document explains just what changes were made in the API.  The changes that affected my map included:<\/p>\n<ul>\n<li>A few method name changes&#8211;<code>centerAndZoom<\/code> becomes <code>setCenter<\/code><\/li>\n<li><code>GPoint<\/code> is no longer used to indicate a latitude and longitude location on a map, and its replacement, <code>GLatLng<\/code>, reverses the order of the constructor&#8217;s arguments.<\/li>\n<li>Zoom levels are flipped around, with larger numbers now signifying higher resolutions<\/li>\n<li>The biggest effort was modifing the code not to use the XSLT process for generating infoWindows.  However, this was easier than I thought it would be.  I simply wrote a javascript method that mimicked what the XSL had previously done.  Sure, accessing the DOM elements was a bit of a hassle that required some debugging (that&#8217;s the win of XSL&#8211;declarative DOM access), but the alternatives were either ignore browsers that don&#8217;t have built-in XSLT support (Safari) or integrate <a href=\"http:\/\/goog-ajaxslt.sourceforge.net\/\">AJAXSLT<\/a>, a Google sponsored project to provide cross browser XSLT support.  If this were a larger project that depended on more XSLT, I probably would have done the latter.<\/li>\n<\/ul>\n<p>Upgrading my (admittedly very simple map) took about 1.5 hours.  <a href=\"http:\/\/www.mooreds.com\/writing\/xc.shtml\">Visit the new map<\/a> and take a look at the code.<\/p>\n<p>[tags]google maps upgrade[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently upgraded a simple simple Google Map that I built last spring to display some of the cross country skiing around Boulder. You can see the original version here. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,6],"tags":[],"class_list":["post-374","post","type-post","status-publish","format-standard","hentry","category-google-maps","category-programming"],"_links":{"self":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/comments?post=374"}],"version-history":[{"count":0,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/374\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/media?parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/categories?post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/tags?post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}