How do online maps work?

Okay I searched “How Stuff Works” and this site for the answer, so pardon me if i missed it.

Anyway, I can figure out the gist of how sites like Mapquest and Yahoo Maps can show you maps of where you want to go (one big map cut into little pieces, right?) Driving directions look like they’re just an educated guess or based on GPS or something.

But how do they show you graphically how to get to your destination? I mean, how do they make the purple line appear on a map from my house to Madison, Wisconsin? Not only that, they can give it to me in 15 different levels of zoom.

When I get a map from AAA, it’s just a pre-printed map with a hand-drawn guide drawn with a highlighter marker. Certainlly this isn’t how Mapquest does it!

Any insight?

The map you’re shown is not stored as a big bitmap - it’s a vectorized drawing. When you ask for a map, they blt it
onto an image and throw the flat image up on the screen.

Further information is known about each road segment that’s stored - namely, its length and speed limit.

The ones on the internet tend to assume that you can turn
any direction at any intersection and make other assumptions.

High-quality data like NavTech knows a lot more about each road semgent - no left turn, one way streets, etc.

The Rand McNally highway road network knows a lot more about the highway network of the US/Canada/Mexico.

But on the internet, it’s just, whatever road intersects another, you can travel on, at whatever the speed limit is.

Then it just draws the roads that comprise your route a second time - but the second time as a purple highlight instead of like a road on a map.

IANAE on this but I am an experienced programmer and I think I can see how it’s done.

Did you ever notice that the streets in those maps don’t have real curves? That’s because what you’re seeing is not a picture that’s stored in a GIF or JPG file somewhere.

What they have instead is a database that has a series of beginning and ending points for each street. A given street may have a large number of points in sequence that are used to represent curves or it might have only one set if it’s perfectly straight.

When you request a map, the map is generated dynamically from that dataset, meaning that the colors assigned to the lines that represent the streets can be set by the program. The designated route can be shown in one color and all the others in black. The dynamic generation method also allows zooming down to the level of granularity of the data, or even allowing interpolation between points.

By the way, if you haven’t checked out the new MapQuest feature which pulls up an arial photo of the area being mapped, do so. It’s fun to be able to see a satellite photo of your house, apartment, dorm, etc.

carry on

I don’t think that the DBs used have a speed limit for every road, that would take up too much space. They have a general idea of what the speed limit is but don’t say what every street limit is. Usually Interstates have the highest so they generalize that, then US highways have the next highest, then secondary roads, then city roads. This can cause problems as sometimes it will take you a longer way because it runs you along interstates where taking the local roads.

I worked for a year using MapInfo making maps for fiber lines. I used a set of digital maps for the entire US that filled up 10 CDs that contained only roads, city limits, and other stuff like that. These CDs were full and contained no Speed limits, I can’t imagine what how big they would be if they had speed limits too. Oh and the roads on these CDs were only one line, not the double lines that they show for highways etc on MapQuest. Those CDs cost twice as much and had 15-17 in the set.

NavTech comes on (6? I think) CDs, Tele-Atlas fits on 3.
And tele-atlas could be smaller.

If your MapInfo data was in a true database, that’s probably
why it was so big.

A speed limit, or traversal time, either one, for each
segment is only one character.

Most MapQuest roads, even show as two lines, are usually
still stored as one. Interstate-class roads are truly
double-digitized, but that’s it.

I don’t have an answer to this question, but I was very impressed when I was using mapquest to get to my sister’s new house in Pa and one of the written instructions said, “take exit ramp, follow “local traffic” signs”. Amazing.

Then lets try an experiment. Since I do this road all the time I know how long it takes etc.

Go from Frederick, MD to Harrisburg (dauphin), PA. Mapquest says around 72.4 miles. That’s about right. Time it takes, 1 hour 48 minutes. HUH? more like an hour and 15 to 25 minutes at most. I’m gonna throw out the in town stuff which is arond 6 miles total. to get through town, those 6 miles lets make it 18 minutes. That leaves 1.5 hours to do 67.9 miles. That’s an average of 45.3 mph. This is a highway, all highway, with a speedlimit of 55 and 65 all the way. Now either they don’t have the true speedlimit or the speedlimit is really off.

Now I haven’t worked with the exact DB that MapQuest uses, and they are all DBs that’s how they work, but to the best of my knowledge this is how these types of maps are made and used:

I think that there is only one company that has actually done the digitizing for the whole US and the everyone else leases the info.

No company actually goes out into the field and maps out the roads, for the original base map they use both USGS maps and TIGER data. Then they goto the local govs and get new proposed roads. Then they might do some gathering on their own.

To the best of my knowledge no one has taken the time to go and get all of the speed limits as it would take years just to get the info. Thats not to say they they are not doing it, but currently I do not know anyone that has. On most mapping programs you can change the average speed limit.

Actually, what you are looking at is probably the output of a Geographic Information system. This is a specialized database that includes spatial information in the form of latitude/longitude points, organized into mapping objects: points (say a historical marker, or town center), lines (such as most roads), and solids (highways, parks, malls, etc). Objects will have associated names and information about how to display the object, and may include other information such as direction or speed depending on how detailed the software designer wants to get.

When you draw the map, you designate an area of interest, and the mapping software will get all of the objects in that area. In Mapquest, there appears to be a heirarchy of objects so that certain objects (like streets) are only shown at certain zoom levels.

I’ve noticed that in Mapquest different streets get their name displayed at different levels. But they don’t have a heirarchy on that :grumble: So even if you have a major street down the middle of your map, you often have to zoom out one to see its name.

I’ve also found that in Mapquest highways that overlap don’t have overlapping data. This makes mapping some businesses near my house not work right. It also made for a really funny set of driving instructions that I read, including “drive 1/4 mile on unnamed road” that was smack in the middle of a freeway.

I’ve found Mapquest to be pretty good, but you do have to reality check it. The funniest instructions I got were to take a freeway exit to the West and then take an extremely sharp left turn to get on the surface street East-bound. I chose to take the freeway exit to the East instead.