Map Scripting


Create Location-based Web Applications

Map Scripting 101 to the Printer

It’s done! We’ve fixed every last detail and the book is off to the printer. It’s been quite a process and it’s lovely to know the book will soon be in the press. Map Scripting 101 will hit shelves in early August.

Map Scripting 101 cover -- full bleed for printer

For those who are curious (and others wondering why this took 18 months), here’s the rough order of things:

  1. I write a first draft of a chapter and send it to Tyler Ortman, my editor at No Starch Press
  2. I almost certainly make some edits based on Tyler’s feedback
  3. Tyler sends the chapter to Derek Fowler for technical review
  4. I almost certainly make some edits based on Derek’s feedback
  5. Tyler sends the chapter to LeeAnn Pickerell, the copy editor
  6. I almost certainly make some edits based on LeeAnn’s feedback
  7. I package up the completed chapter, along with all the screenshots and figures and send them to Ansel Staton, No Starch’s production assistant
  8. Ansel sends me a PDF of the chapter and it starts to feel real
  9. I reply to Ansel and the production team’s questions
  10. Tyler sends the nearly-complete book to a proofreader and an indexer
  11. I make final changes and add an introduction/acknowledgments

Somewhere in there we chose the title, Tyler arranged for a cover design, the book was officially announced and No Starch worked up some snappy back cover copy.

Thanks all who have followed along! There’s plenty more mapping to happen here, as I’ll be previewing the various sections of the book and sharing the five mashup examples that wrap everything together.

Happy 5th Birthday, Google Maps API

Google Maps API celebrates five years

It’s been five years since Google released the first version of its mapping API. Almost instantly the term “mashup” became synonymous with plotting data from one source on Google Maps. And since then, it’s gone from fun little toy to extremely useful tool. And while I appreciate all mapping APIs, it’s important to note this milestone for the influential platform. Let’s look where we are and how far we’ve come.

It’s easy to forget now, but the API followed some unofficial hacks (we celebrated this anniversary in April). Adrian Holovaty’s ChicagoCrime plotted public crime data in Chicago. Paul Rademacher’s HousingMaps let house hunters browse Craigslist visually. Holovaty’s site went on to become EveryBlock and roll its own mapping platform. Rademacher now works at Google.

Initial Reaction

There was tremendous excitement surrounding the announcement, Google making it official. Yet it’s quaint to realize that Google’s announcement came via a three sentence blog post and a spot on stage at the very first Where 2.0 Conference. It was not covered in TechCrunch–the site had barely launched.

I excitedly wrote about it on my own blog and quickly added maps to my Portland WiFi finder.

Everyone Adds a Mapping API

The Google Maps API probably didn’t take other map provider’s by surprise. Yahoo, for example, announced its API the following day. If it had been easier to use and wasn’t Flash-based, we might be living on a different geo web. Less than a month later Microsoft had Virtual Earth.

And around the same time the open source project Mapstraction was born. It now covers about a dozen mapping APIs with a single interface.

The Cutting Edge

It’s no longer enough to simply have a map. If it was, there wouldn’t have been much of a reason for me to write a book. Innovative developers will always push the boundaries, but here are some ways APIs are making it easier to create unique map apps:

  • Change your actual map imagery: Open Street Map beget CloudMade, which had to have inspired Google’s map styling. Now anyone can have a truly custom map.
  • Access data, where you want it: Administrating a geo database used to be hard. Now you can store your data in the cloud with My Maps Data or SimpleGeo. Or, if you want at public data, there are any number of sources to get just the information you need at the moment where you application needs it.
  • Mobilize your maps: The potential of the mobile web is being realized. Smart phones know our location and can display the Real Web on beautiful, touchable screens. Unfortunately, the bandwidth and processing power on a tiny little phone isn’t quite up to computer speeds. That means that the speed of mapping APIs is becoming even more important. That’s why we saw Google switch to version 3, which was initially built with mobile devices in mind.

Maps in 2015

Will this post look as quaint in five years as the Maps API announcements from 2005 do now? Probably. With as much as we’ve packed into the Map mashup era so far, we’re moving even faster now. Thanks to Google Maps–and the developers who use any mapping APIs–we’re just getting started exploring the world around us.

Start Here Guide Translated to Spanish: Traza En Español

For those who want a quick introduction to mapping on the web, I’ve offered my Start Here Guide for the last year. My full book is coming soon (did you know you can pre-order Map Scripting 101?), but the guide will remain. In fact, now it’s also available in Spanish.

I’m indebted to Claudio Cossio of Frontera Estates for not only the translation but the idea to offer a Spanish version in the first place. Thank you, Claudio!

So, regardless of whether you want it en ingles o en español, you can Download the Start Here Guide for free.

Map Scripting & Design

There are so many great tools for creating maps on the web, but so many maps are still boring (some of mine included!). There is an opportunity to set your maps apart, as I described in my SXSW talk. Also, the interaction with maps and their associated processes are still being figured out. This is another area where designers can make a huge impact.

I recently gave a talk at Refresh Portland with this message. I’ve embedded my slides below and pulled out a couple links I mentioned:

If you’re interested in walking through a map project together, from the basics to plotting data from outside services, I’m giving a half-day workshop, Hands On Map Scripting, at WebVisions.

Way Cool Map Scripting

Way CoolI presented a talk on moving beyond the typical map mashup today at SXSW Interactive in Austin. In it, I showed some simple ways to improve your maps, from using Mapstraction to custom map markers to changing the entire map imagery.

If you would like to get a feel for the presentation and examples, my “slides” are one giant HTML file. Really, it’s quite giant. So I’ve included the examples below. View the source, look around. Many of these are explained in detail in Map Scripting 101, but if you have questions I’d be happy to cover some more in-depth on this blog.

Map Math Behind a Virtual Grand Canyon Hike

The pedometer community site Walker Tracker added a new feature that plots your steps on a route around the rim of the Grand Canyon–or a handful of other locations. And you can invite your friends on the trip, with each avatar shown at a location determined by the user’s step count.

This is the site’s first foray into using maps. Ben, the site’s founder, contracted me to write much of the code for the new feature. Walker Tracker has an active community of step-counters who already take part in a number of competitions on the site. I’m happy to see this new competition type go live into Beta.

I used the site’s API to grab the current competition results and convert steps into a distance. That turns out to be the easy part, as the average person travels a mile in 2,000 steps. So, to keep things fair, we used that constant. No advantage for the long-legged!

Finding out which leg of the journey a user is on was also fairly easy. Once I knew the user’s distance, I could keep a running total of each leg until the next point would make it further than the user’s distance. Then I knew the user was between two particular points. On some routes, the points could be many miles apart. Walker Tracker needed to be more precise than that.

Find a Point Along a Route

The mapping challenge here was to plot the walker at just the right point along the route. That turns out to be a fairly complex problem and the solution has become a section in my book.

The example above shows three points. It’s a two step process to find point X, 0.3 miles between points A and B:

  1. Find the initial bearing (direction of travel) from point A to B
  2. Using the bearing, determine the point 0.3 miles along the route between points A and B

As for how to calculate the bearing and the point along the route, these scripts from Movable Type were immensely helpful.

Mapstraction V2 In The Wild

Around the time I started the book, the group of volunteers behind Mapstraction started working on a new, improved version of the open source wrapper library. This is the mapping API I recommend because it allows developers to write code once that works on any mapping provider. Also, I use Mapstraction throughout the book, so I want to see it be successful. So, for the first time, I contributed code to an open source project.


This new version of Mapstraction is now showing up in production on sites around the web. For example, Nestoria, a real estate search engine based in the UK. Nestoria has long used Mapstraction and helped fund its initial development, so it’s not a big surprise to see if leading the way with the switch to the new version. What is exciting is that Nestoria was able to decrease a user’s download by 100K by switching to the smarter V2 of Mapstraction.

At the same time, Nestoria also switched mapping providers to the third version of Google Maps. I’m proud to say that Nestoria contracted me to help support this provider in Mapstraction. My thanks go to Ed Freyfogle for the opportunity.


Open microblogging platform Identica recently implemented maps on its service. Any status message that has been geocoded will be displayed on a map. And like Nestoria, it chose Mapstraction V2, another good sign.

Want an introduction to Mapstraction? My Start Here Guide has been updated to use the latest version, or check out the API sandbox.

Get Out of That Rut

Today I launched a new site to show what is possible with the NextStop API. My site is called unrut and it helps you find new places where you haven’t been before–it helps you get out of a rut!

Searching Portland for pizza...

Enter your location and a search term. Through the magic of Ajax, the results are loaded and plotted on a map. There is a thumbnail photo for every result, plus a recent recommendation from a NextStop user.

The really fun part comes once you’ve marked the places you’ve already been. You’re left with a list of new places to try!

Give it a whirl and let me know what you think.

MapQuest Mobile Implements Browser Geolocation

MapQuest Mobile geolocationNow this should make you feel good about mobile web standards. Mapping pioneer MapQuest is now using the geolocation standard to provide directions from your current location in MapQuest Mobile —, which does not work in a non-mobile browser.

When you select a text field, MapQuest provides an option to use your current location. Then, when you submit the form, the browser requests your location.

The MapQuest blog post references Android, but it also works on my iPhone. And, since it’s a standard, it will work in any other mobile browser that uses the JavaScript geolocation I described when the iPhone OS 3.0 was released.

It’s great to see more of this “in the wild,” especially from a major player like MapQuest.

A Year of Map Scripting

Alternate title: that sure took longer than I thought.

Loading Act II

It was a year ago today that I sat down to a blank OpenOffice screen and realized a book is a big project. Despite that, I intended to be done much sooner. And it’s not even done yet. The project continues, with technical review and copy editing happening right now.

I wrote about the writing process on my personal blog and I’m sure I’ll have more to say when the book is truly finished. But for now, thank you for following along. It’s been a fun year and I look forward to a great 2010 of more Map Scripting.

Adam DuVanderHi, I'm Adam. I'm writing a book about developing maps on the web. This site is where I'll share the things I find and help you create your own maps. Find out more.

Map Scripting 101