Plot multiple locations on Google Maps

Plot multiple locations on Google Maps

Hey all

A few days ago, I had two appointments downtown in the financial district on the same day. I wasn’t sure how close they were to each other, so I got the idea to look them up on google maps. However, I soon found out that you cannot plot more than one location on google maps at a time. (Well, that’s not completely true, since you could plot one point, and then get directions from there to the other place. But then what would you do if you needed to plot three places?)

So, I decided to see if I could hack something together using the Google Maps API. The result is at:
http://gmaps.kaeding.name

It isn’t pretty, nor is it perfect, but hey, it works (at least when the addresses are accepted by the geocoder).

You enter as many addresses as you want, one per line. Then the script sends those strings through geocoder.us to get latitude and longitude. (The Google Maps API only allows you to plot points using latitude and longitude, not by supplying an address). Sometimes, geocoder.us will come back with more than one possible address for a single string. So, the next page asks you to confirm the addresses. The final page displays the map.

[ad]

The flaws right now are that the map will always be centered on the first point, and the zoom level is set at 5. Of course, you can move it around, but it would be nice if the program automatically zoomed/centered the map to show all of your points.

Also, sometimes the geocoder doesn’t like certain addresses. For example, numbered roads don’t work (like state highways). All areas of Boston list Boston as the city (for example, addresses in Jamaica Plain, which is part of Boston, will come back as Boston). These problems are caused by incomplete data in the TIGER data set, which was generated by the Census.

Also, the page that asks you to confirm the addresses doesn’t show you were the suggestions are (it displays the address, with zip code, but not a map or anything. That would be cool.)

Anyway, give it a shot, and let me know what you think.

-Patrick

PS-
Here’s the link again:
http://gmaps.kaeding.name

UPDATE: I just changed the links above to point to the new location. If you had already bookmarked the old spot, please update.

This entry was posted in gmaps.kaeding.name and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

19 Comments