Is there a way to query a Google map and have it look up a database and display a message?
July 13, 2009 10:59 PM   Subscribe

Is there a way to query a Google map and have it look up a database and display a message?

I provide a service within a certain area. On my website, I have a Google map, and a JPG file associated with a KML which illustrates an area where my service is provided.

I want to make it so when customers search in the map, and is within my serviceable area, I want something to pop up and say "we can serve you". If not, it takes them to another page.

Is this possible?
posted by friedbeef to Technology (6 answers total)
 
If you can define your "serviceable area" by zip codes, that's a much easier thing to build, no Google or mapping needed.

You can probably even do it in Javascript (no back end needed at all) by just matching the first three or four digits, etc.
posted by rokusan at 11:54 PM on July 13, 2009


Response by poster: Thanks, but my area is not demarcated by zipcodes. It's a physical area which I have mapped out. I know it makes good business sense to demarcate by zipcode, but this is a technical limitation which is impossible to overcome.

Is there a way to do this?
posted by friedbeef at 12:33 AM on July 14, 2009


If you translate your service region to into a gpolygon (defined by lat/long vertices I think) then you should probably be able to hook whatever you want onto the click event for the gpolygon. I don't know squat about KML so I have no idea how hard it would be to convert your service region shape into a lat/long vertex defined one either manually or programmatically.
posted by juv3nal at 12:46 AM on July 14, 2009 [1 favorite]


You're still asking people to, um... search for their own address on your map, not yours, right?

That seems a bit odd, or backwards, or something I can't put my finger on. Don't get me wrong, I love Google Maps, but this strikes me as an odd application of it. Maybe I'm seeing it all wrong.

What about just forgetting the interactive map and having a human illustrator make one, static but perfect and pretty map that shows all the relevant streets and a big red circle (or whatever) for your area? As long as you're talking about a sub-part of a city, people should be able to tell "at a glance" if they're in the red region or not.

(Also, that way nobody will be hinky about surrendering their address so early in the process, since they keep the info in their own heads.)
posted by rokusan at 1:57 AM on July 14, 2009


Response by poster: @juv3nal: Thanks - I'll check it out

@rokusan: Agree that a big red circle is easy, i just want to automate the process and tell our prospective customers we've got them covered :)
posted by friedbeef at 4:17 AM on July 14, 2009


I too don't see much of a point in this particular application. That said...

Given that every point in Google Maps has coordinate information, you could calculate the distance from a central location (or use your own means of comparing points A and B if the 'big red circle' doesn't apply). That can all be done in JavaScript.
posted by spamguy at 6:55 AM on July 14, 2009


« Older Is possession for nouns that end in x indicated by...   |   Dog Regurgitating Newer »
This thread is closed to new comments.