Google Maps API Tutorial

© 2006, 2007, 2008, 2009 Mike Williams

 
Translate this page:

 

The Book

Beginning Google Maps Applications with PHP and Ajax

If you want to take your Google Maps further. If you want to take them a lot further, then get the book.

Beginning Google Maps Applications with PHP and Ajax by Michael Purvis, Jeffrey Sambells and Cameron Turner goes a long way beyond what I've been able to include in this tutorial.

Don't be confused by the word "beginning" in the title of the book. This is not a book for beginners. If you don't have solid grounding in HTML, Javascript and PHP then this book is going to leave you standing. Familiarity with CSS, mySQL, Ajax and XML will also help. I confess that some of the sections were beyond me.

The book isn't perfect. There are a few typos that you'll spot immediately you try to write pages that use their code [like "map.addControl(GMap2TypeControl());"]. I, personally, think that it's a mistake to assume that all your users will have Javascript enabled, rather than using <noscript> to explain to users without Javascript why they're looking at a blank page. I also think that the section of using the Yahoo Geocoder should have mentioned that it is a violation of the Yahoo Terms to use the Yahoo Geocoder with Google Maps.

One problem with books related to the Internet is that they get out of date really fast. An awful lot has changed since 2006 when the book was published. When the book was written, the API had no GDirections, GGeoXml, GAdsManager, StreetView, GScreenOverlay, GGroundOverlay, Encoded polylines, G_PHYSICAL_MAP, G_SATELLITE_3D_MAP, GMarkerManager or GTRafficOverlay. The Open Source library did not exist, so there was no MarkerManager, LabeledMArker, ExtMapTypeControl, ExtInfoWindow or MapIconMaker. Polygons and polylines were rendered with either VML or via the image server, not SVG or canvas. There were no My Maps, and no Google Spreadsheets. No Google Charts, no Google static maps and no embedded maps. In wider Internet, there was no Firebug, no Safari for Windows, and no Google Chrome.

When it came out, I reckoned that the book should be an indispensable part of the toolkit of any professional web designers who want to include advanced Google Map techniques in their web sites. Things have changed so much in the last two years that make the book rather less useful these days.

The book is divided into three parts.

Part 1: Your First Google Maps covers things like allowing users to add markers and related information to your map and store it in a mySQL database and fetch it back so that other users can see it.

Part 2: Beyond the basics covers things like handling huge numbers of points using several techniques, including creating a custom tile layer generating the tile graphics dynamically in the server, and caching the images to improve response times.
There's an example at http://googlemapsbook.com/chapter7/ServerCustomTiles with a map that displays over 115,000 data points.

Part 3: Advanced Map Features and Methods covers some advanced topics, like the ability to write your own geocoding service, like this one: http://googlemapsbook.com/chapter11/UKRest/index.php?code=AB10.

There's also lots of ongoing support from the web site associated with the book, http://googlemapsbook.com including copies of all the source code printed in the book and updated information about things like available geocoders and data sets.

Back to Mike's Homepage
Up to the start of this tutorial