Online maps are a popular way to spice up a site. To get the most use out of them, you need data to plot: addresses from a database, location clicks from the user or at least coordinates for the map’s center. With any map, you have to start somewhere.
If you’re low on data, you can fill in the map with local listings, such as those you’d find in the Yellow Pages. You can show coffee shops or pizza joints right along your other data, or even on its own.
In this tutorial I’ll show how to use Yahoo Local to search for nearby businesses and landmarks, then plot those locations on a Yahoo Map using the Ajax API.
It seems every mapping website has an API these days. Google, Yahoo, Microsoft, Mapquest… how do you choose? With Mapstraction, you don’t have to.
To help you on your way to using Mapstraction, we’ll simply create a map we can display on a web page, and then add a marker to denote a particular location.
Mashups, web apps which merge two or more data sources, essentially arose from the introduction of the Google Maps API in June 2005. APIs for easily accessing data existed before then, but a way to visualize it geographically was a huge tipping point.
Due to the popularity of map mashups, ProgrammableWeb’s mashup directory is over a third mapping-related. But something interesting has been happening: other types of mashups are becoming popular. Over the last two weeks, for example, maps mashups are only 20% of the new additions to the directory. Granted, it’s a small sample and mapping is still tops by far, but other ways of mashing up data are becoming more relevant.
How can mashups be both dead and more relevant? Consider Friendfeed, which aggregates your data using APIs of several social websites, pulling in each item you and your friends post to Twitter, Flickr, Digg, your blogs. It fits the criteria of a mashup perfectly. If Friendfeed was entered into the recent MashupCamp contest, it would have come away victorious. Friendfeed is an uber-mashup, though nobody calls it that.
Mashups are dead because the whole web is becoming a collection of APIs. In the future, showing an embedded map of liquor stores near that New Year’s party won’t be a snazzy add-on, it will be a necessary feature.
What’s cooler than Google Maps? Tools built on top of it. Developers from the Netherlands have released some helpful libraries to make more usable, interactive Google Maps.
Google hosts an open source utility library with several useful examples. Among them, a drag-to-zoom feature and a way to create dynamic labeled markers.
A progress bar is among the new additions to the libraries. When adding more than just a few markers, it can take some time. Rather than make your users sit through the slow-down, this library shows the progress via a popup status bar that fills as it completes.
The other new library, SnapToRoute, allows developers to restrict some actions to just along a polyline. The example included shows zooming along a specific route.
I love these sorts of libraries that make creating advanced maps easy. Of course, I’d love to see platform-independent examples, so developers of any map API could benefit. These libraries would be great to see as a part of Mapstraction, the multi-map I covered in a tutorial.
Toss out that MySQL book. The only thing you need to store location data is Google Maps.
My Maps is a feature that lets you create your own mashup on a map. Once a map is created, it can be shared with a link, or in Google Earth with a KML file. And now, it is also available via RSS–GeoRSS, to be more specific.
While viewing any My Map, click the RSS link to see the GeoRSS version of the map. In addition to all the other information about points on the map, such as business name and address, you get latitude and longitude coordinates.
This RSS feed can then be read in by any script you write instead of making a database call. The Google Maps API can even call GeoRSS files directly, loading all your locations in a single line.