Beginning Google Maps API 3 Released!

Ok, just one more post then we’re out of here for good. Thanks for everything. You’re all awesome.

Apress has just released what was scheduled to be the “2nd edition” of our book written by Gabriel Svennerberg: Beginning Google Maps API 3. If you’re looking for a book to get started, DO NOT BUY OURS, buy his.

Beginning Google Maps API 3

Happy Mapping :)

Frozen in Time

As of this month (February 2010), will be converted into a static HTML archive and be completely decoupled from PHP and Wordpress.

Four years on and the book is still selling really, really well (THANK YOU ALL!), but it’s become obvious that this site and the book are only useful as v2 references. With the release of v3 last March we, as authors, cannot keep up with the rapid pace of change in the Google Maps API.

The book still serves as a useful reference for the deeper topics in mapping, but for a quick start and rapid prototyping, v3 simply can’t be beat.

Therefore, after reading our book (of course), we suggest you visit the Official Geo Developer’s Blog and the Official Google Geo Support discussion group to hone your mapping skills.

As a parting gift to everyone who is just arriving here for the first time, here are the top blog posts (either by importance or number of comments):

Thanks again everyone. You’ve all helped make this book and our experience supporting and writing it an excellent one.

Take care and happy mapping,
Cam, Jeff, Mike and Andre.

One of the most frequent questions we get via email is “Your book is two years old. Is it any good now?” While only you can answer that question, we certainly think so. When we set out to write the book we put a lot of effort into the fundamentals of mapping. We covered the underlying concepts behind geocoding, the math involved in projections and distance calculations on a sphere, working with massive data sets and even interface design considerations.

But what about the API? Hasn’t it changed… a lot? Yes it has, but very little of what we wrote about changed since we took great care to only write about what was already stable in version 2. Google has added lots of neat new features that make some of our techniques look like the “long way” but they still work. We also think that knowing the foundations will help you do some of the more complicated things that the API doesn’t support with a single function call yet.

Basically, Google has added many new features (some of which we predicted in the book), but they haven’t changed the core of the API very much (if at all). The only downside to this is that our book isn’t much of a beginner book any more. Two years ago the techniques we listed were the only way, now they are really more like advanced topics and techniques.

The good news is that APress has released a new book on the Google Maps API that covers the new features and is primarily client-side javascript. This means that everyone who cringes at the thought of server-side stuff has a new book to pick up and new things to learn…

Beginning Google Maps Mashups with Mapplets, KML, and GeoRSS: From Novice to Professional by Sterling Udell

It was released mere weeks ago and is awaiting your reviews at Amazon. Congratulations to Sterling Udell on an excellent book and we hope that Amazon continues to pair our books as a bundle for years to come :).

There is also Jeff’s second book on AdvancED DOM Scripting: Dynamic Web Design Techniques if you’re interested in that. An excellent book that I did the technical review for. It’s published by Friends of Ed, a sister company to APress.

Happy Holidays everyone.

Google SKY!

I thought I’d share this with anyone who hasn’t received it yet… Another example of what you could do with the maps interface and an alternative tile set like Jeff’s blue-marble map.

Starting today, astronomy enthusiasts can now view imagery of millions
of celestial objects online - without downloading software.

Google Sky brings the imagery and functionality of the popular Sky in
Google Earth feature to a web browser, making it easier than ever for
students, amateur astronomers and professionals alike to explore the

By simply pointing their browsers to, users can
browse, zoom and pan the sky, search for stars and galaxies, and link
to any place in the sky. The same layers that are available in Sky in
Google Earth, such as “Backyard Astronomy,” “Hubble Showcase” and
podcasts from the radio program Earth & Sky can be accessed by
clicking on an image strip that appears along the bottom of the page.

For instance, the part of the sky visible when a user first loads shows the Cigar Galaxy (also known as Messier 82), one
of the most striking galaxies in the universe. Switching on the
infrared view of the sky using the “Spitzer Infrared Showcase” button
at the bottom of the screen will overlay images from NASA’s Spitzer
satellite and show how different the Cigar Galaxy appears in the
infrared. When the overlay is activated a slider will appear, letting
users move back and forth between infrared and optical light. To look
in more detail, users should zoom into the galaxy or enter its name in
the search box.

Rails 2 changed the way to_json works on ActiveRecord objects. Prior to Rails 2, to_json returned a hash of hashes — the first level hash had the key ‘attributes’, which in turn had another hash with your field name/values.

With Rails 2, calling to_json on an AR object just gives you a hash of field name/values. The new way is easier and more intuitive. However, in breaks our code in places where we use to_json to pass AR data into JavaScript.

The changes are straightforward. There were two ways we dealt with the intermediate “attributes” hash prior to Rails 2:

  1. we used map/collect before calling to_json, i.e.: cities.collect{|c|c.attributes}.to_json
  2. we dealt with ‘attributes’ in JavaScript, i.e., var marker=markers[i].attributes

Fixing it just means removing references to the ‘attributes’ and using the ActiveRecord instance directly.

Here are all the places changes need to be made:

  • 3.8: var marker=markers[i].attributes to var marker=markers[i]
  • 4.6: all instances of result.attributes to just result
  • 4.15: var stores=<%=(@stores.collect {|s|s.attributes}).to_json%>; to var stores=<%=@stores.to_json%>;
  • 5-12: remove the to_json method from class Tower
  • 7-2: render :text=>cities.collect{|c|c.attributes}.to_json to render :text=>cities.to_json
  • 7-5: render :text=>cities.collect{|c|c.attributes}.to_json to render :text=>cities.to_json
  • 7.15: var points=<%=@towers.collect{|c|c.attributes}.to_json %>; to var points=<%=@towers.to_json %>;