Two Years and Counting. Is Our Book Still Useful?
2 Comments Published by Cam December 9th, 2008 in The BookOne 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…
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.
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
universe.By simply pointing their browsers to http://sky.google.com, 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
sky.google.com 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.
to_json and Rails 2
4 Comments Published by Andre February 13th, 2008 in Fixes, JavaScript, Ruby on Rails, The BookRails 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:
- we used map/collect before calling to_json, i.e.: cities.collect{|c|c.attributes}.to_json
- 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 %>;
Amy writes “We just posted an article Top 50 Things You Didn’t Know You Could Do With Google Maps. I thought I’d bring it to your attention just in case you think your readers would find it interesting.”
Indeed. Some of this will be well known to our readers, however our newer mashup friends might find something here that is interesting. Enjoy.
PHP and asinh() on Windows
1 Comment Published by Cam November 15th, 2007 in Fixes, Geometry, Overlays, PHP, ProjectionsIn the last few weeks we’ve seen an explosion of people complaining about the lack of asinh() on the Windows version of PHP. We use the asinh() function extensively in Chapter 7 for the custom tile overlays. Admittedly, we didn’t test any of the code against windows versions of PHP (we’re LAMP folks), so until the middle of September when Stuart contacted us to ask a question we had no idea about the problem. Continue reading ‘PHP and asinh() on Windows’
Search
About
We're Cam Turner, Jeffrey Sambells, Mike Purvis, and Andre Lewis. We filled up these books with information about the Google Maps API, but there was so much to cover that we've kept on writing here.





Subscribe