Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Google Maps API to dynamically embed a map based on an address - Need to use Google's data for the markers/bubbles

I am trying to embed a Google Map into a dynamic webpage. The only variable the map depends on is the address of a business. That address comes from the website's database. I cannot just statically generate embed code for each dynamic page using the same set up. Is there a way I can embed a map based on that address and show a marker/bubble showing Google's information on that business?

So far, I have explored a few options including using the Google Map API and the Google Data API or just messing with the embed code given by Google. If I use the APIs it seems I have to design my own types of markers and maybe even supply my own data.

It doesn't look like there is an easy solution.

Any ideas?

Thanks.

EDIT: I'm not hung up on going from an address to a longitude and a latitude. I want the info window or "bubble" for a marker to show Google's information of a business.

EDIT: On Roy's suggestion I have been trying to use the map and search API together to achieve what I want. However, the only way I can execute a search with searchControl.execute('business name here'); is if the SearchControl is drawn. Thing is though I don't want to show any search controls. I have been able to hide it, but that just seems like an inefficient hack way of solving this.

like image 689
Will M Avatar asked Mar 04 '10 15:03

Will M


1 Answers

Don't just use the embed code. Write a bit of Javascript that will draw a map for you and pass it the address.

Loads of examples here: http://code.google.com/apis/maps/documentation/examples/index.html

I'm not sure which bit you're stuck on, but you don't need to design your own markers. Google can also create a marker from an address and it can find local business information if it has it (using local search API I think).

like image 172
Roy Avatar answered Oct 20 '22 13:10

Roy