||Saturday, October 28 2006 @ 06:14 PM PDT
|There's a fundamental difference between how people and computers write travel directions. People are usually much more able to gauge whether or not something is relevant, and tailor the directions accordingly. Today I was writing directions for my sister, and I know she knows how to get to Boston - it's the part from the exit on that I was writing directions for, and I thought it could use a map.
I've found in my own travels that the hybrid view in Google Maps is very good for giving me not just turn by turn directions but also context. I can see the way a road curves, and how the turn I'm looking for might not be visible until I'm right on top of it. The problem is that when you're giving somebody else directions, having the route highlighted is effectively a requirement, but how do you start a route at an arbitrary spot on the highway, or how do you end a route at a place that has no address?
Let me show you.
Let's take as an example someone from the south shore of Massachusetts who's going to Castle Island (technically the name is "Fort Independance Park" and it's neither a castle nor an island, but that's really beside the point.)
We'll start by getting a map centered around the fort, so I go to maps.google.com and enter "fort independence park, south boston, ma" (click to display)
That query didn't work, so we'll expand the results by clicking the "See all 1,556 results..." link. (click to display)
There has to be a better way to do this.
Let's start over, and just get to the right neighborhood. (click to display)
Castle Island is at the end of the peninsula just south of Logan, but how do I tell that to Google Maps?
The key here is the "Link to this page" link at the top right of the Google Maps screen. When you click that link, it replaces the URL in your location bar with a URL that would give you exactly what you're currently seeing, after you've done all your panning and zooming and switching views around. What we're going to do is lift some information out of that URL and feed it back to Google Maps as input.
So, first let's get a good shot of Castle Island in Hybrid view. (click to display)
Now, let's quickly deconstruct the URI:
For those of you not familiar with how URIs are constructed, I'll do the whole thing, rather than just lifting the interesting bits.
http is the application protocol identifier.
maps.google.com is the host address, in fully qualified name form.
No port information is provided, so the browser defaults to the application protocol default, in this case 80.
/maps is the path to the document requested.
Everything after the "?" and before the "#" (which isn't present) is part of the query string, which has its own rules. First we split it up wherever there's an ampersand:
Everything on the left side of the equals symbol is the name of a field, and everything on the right is the encoded value for that field. The encoding basically just replaces characters that would cause problems for the computer that is trying to read the URI, so it's pretty straightforward. In this case, the only encoded characters are the two spaces in "south boston, ma" being translated to plus symbols.
Not surprisingly, the "ll=42.338138,-71.011274" gives us the coordinates of the center point on the map.
This information looks like it might come in handy, so let's do the same thing for a spot on the highway before the exit. (click to display)
This one yields "ll=42.299587,-71.047844"
Let's try plugging these values into the directions mode. (click to display)
That works like a charm, but I personally prefer the drive along Morrissey Boulevard, so I'd rather take that exit than the Columbia Road route that the directions provide. In this particular case, the easiest way to make that happen is to pick the exit ramp itself as the starting point. (click to display)
This won't work in all situations, so maybe one of these days I (or Google) will figure out a way to add in waypoints along the route - a much requested feature of theirs.
Incidentally, if you want to save a click, when you're looking for directions you can just type "from: place1 to: place2" into the main Google Maps search box. The same final map from above done this way looks like this: (click to display)