Map Scripting 101

An Example-Driven Guide to Building Interactive Maps With Bing, Yahoo!, and Google Maps
Beyond GoogleMaps, using Bing and Yahoo Maps in your web apps.

When developers have looked to add an interactive map to their web pages Google Maps is probably near the list of providers. However, there are several other choices available, not to mention what if you want to change providers in the future? Map Scripting provides an answer to that question that many readers might have heard of.

The book covers creating interactive maps using Mapstraction, a library that provides a common API for various JavaScript mapping APIs. According to Mapstraction’s site, it supports more than 11 major mapping providers including Google, Bing and Yahoo as well as less-known ones like the crowd-sourced OpenStreetMap. Early on the author makes a good point about one reason you might want to have the ability to change the map service you use: what if they start charging for it- or put advertisements all over a free version of the maps? The latter is undoubtedly possible.

Map Scripting has ten chapters that deal with all the usual tasks you’d expect to do with a map API: geocoding, drawing on the map, event handling, user location and mash-ups. All these are demonstrated using Mapstraction and, if necessary, using the native functions of an API. One case is an example that calculates the actual distance between two locations using Google’s route calculator, then uses Mapstraction to plot the route. The book wraps up with chapters on server-site operations in PHP and a set of mash-ups using YQL, and Yahoo! Pipes. As well, two appendices are covering the Mapstraction API and an introduction to Javascript and jQuery. The tutorials are relatively basic, but they seem to be intended to give readers enough knowledge to understand the examples.

See also  Head First Python

Previous to this book there were only a few books on using Google Maps, probably going back to Apress’ Beginning Google Maps Applications with PHP and Ajax from 2006 and I was unable to find anything on specifically on Yahoo maps. Looking back at Beginning Google Maps, it’s nice to see how much time a library like Mapstraction saves.