Tonight I’ve been doing some work on a website that needed an embedded map. Naturally, I turned to Google Maps, only to discover there’s really two ways of using them.
Firstly, the iframe method. That really sucks, because I’ve no control over how the map looks, or what information is presented.
Secondly, the API. I’ve used this once before, but only as a copy and paste job. Now I discover there’s a new version of the API, much cleaner and better written. Plus, there’s no need for the API key anymore. Perfect. Only, as I read through the documentation, I discover this is a very powerful API, with similarly obtuse documentation. There’s one example map, plus a number of contributed pages purporting to be tutorials. Some just didn’t exist any more, and others were even more confusing than the API documentation.
Lastly, I needed to work out how to put the map into a drupal node. Every example seemed to make use of the onLoad property of the body tag, which obviously wouldn’t do.
My final result was this:
<div id=”map_canvas” style=”width:400px; height:400px”></div>
<meta name=”viewport” content=”initial-scale=1.0, user-scalable=no” />
//map generating code went in here
May 30, 2010 at 3:38 am
You’re welcome Nathan! I’m glad that you found my articles useful! 🙂