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.
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.
13 Comments
Could you fix it so that the number on the list is on the bubble so that if you print the list out and the map, the numbers correspond to the locations?
Patrick,
I have a couple of questions about this. How can I contact you? Thanks.
This isa great idea!
That is a good idea. I will look into adding this feature when I get some free time.
Hi Patrick, — This is a great start, but there may have been a flaw introduced, in that I entered 3 map positions, all with the same Latitude but the resulting map indicated points at different Latitudes. Just in case it is data dependent, here is what I entered:
45.6404,-93.9771{Easterly point}
45.6404,-93.9775{w}
45.6404,-93.9789
Maybe it is the format? I appreciate your effort, and esp. the query save feature.
By the way, what & where is the volcanic rock over here on the right?
– Greg M. in Minnesota
Hi Greg
What is happening here is a result of how I am handling the input ‘addresses’. I am passing the location (minus the description in curly-braces) to the Google geocoding service, which is designed to translate between street addresses and latitude/longitude coordinates. A side effect of this is that if you input coordinates, Google assumes that you want to find the closest street address to those coordinates. Thus, you have the locations you plotted following Rte 23. You can see the address it is using by clicking on the markers on the map. You will see something like “8901-9499 Minnesota 23 Trunk, Foley, MN 56329, USA”
So, in order to allow users to plot coordinates (and not force these locations into street addresses), I would need to run a check to see if the ‘address’ appears to be coordinates, before sending the it off to Google for geocoding. This is certainly doable, and I will add it to my list of enhancements that I will add when/if I have the time, but I think it would probably benefit very few users (as most people are entering street addresses in the first place).
I hope that answers your question.
The volcanic rock photo on the right (and in the title bar) are from my trip to Hawaii Volcanoes National Park this past January. It was a lot of fun; we saw some amazing landscapes!
Hi Patrick ,
I thought I had posted my comment yesterday, but could not find it this morning. I apologize if I repeat myself.
First I am a complete amateur, and I am plotting (?) for my non-profit. I would like to plot the addresses of all of our 200+ donors so as to have events by neighborhood, visits by neighborhood, etc.
Is that number too big?
Also, I know that I can save my map by creating a new URL. Is there any way I can go back and edit a URL ( same exact address)? Or, can I delete an address and re-use it?
Thank you for creating such wonderful and useful powers for Google Maps!
Sincerely,
Ana
Hi Anna
Yes, your first comment did go through. It was just added to my moderation queue, since you were a first-time commenter. (Now that I have marked you as not a spammer, your comments should be automatically approved.)
You are right about not being able to edit saved maps. This was a decision I made early on, since I didn’t want to force users to sign up for the service, and create a password (which they might forget, and then I would need to create a way for them to recover the password, etc). So, once you create a map, it is final. You are certainly welcome to create a new map, but your old one will remain. If you have frequently changing data, I suggest creating a naming scheme, like ‘AnasNonProfitFeb2010′. Next month, you can create the new version, ‘AnasNonProfitMarch2010′.
Thanks!
Doesn’t look like you’ve touched this in years. It would have been much more useful it if had labels. I plotted 15 locations, so it’s nice to see it on a map, but I don’t know which one belongs to what. But, thanks it should provide some help.
Nevermind. I just wrote them on the printed paper by hand. Close enough.
Hi John
Yeah, it has been a while since I’ve had time to work on it. You aren’t the only one who has requested this though, so I do plan on adding this feature when I get a chance.
Thanks!
I’ve been looking around trying to find a tool to do this. I’ve just made a map with 700 sales leads. I can’t imagine how much time (and gas) you’re gonna save me. Sincere thanks, you’ve made my day!
being able to plot multiple lat/long coords would be useful to me as well.