Brett
Brett

Reputation: 20049

Google Maps - Getting the info window to show?

I've currently got a Google Map showing successfully and it looks like this:

enter image description here

I want it to show with the info window showing by default, like this example:

enter image description here

I read this page: http://code.google.com/apis/maps/documentation/javascript/overlays.html#InfoWindows but that seemed to only explain how to make an info window with your own custom content. I just want to show the info like the example above where you see on many sites.

Upvotes: 2

Views: 2890

Answers (2)

andresf
andresf

Reputation: 2061

You can use the Places API:

http://code.google.com/apis/maps/documentation/places/

Or the Places Library (part of the Google Maps JS API):

http://code.google.com/apis/maps/documentation/javascript/places.html

You'll parse the response in JS and then set the content of the infowindow as needed. Note that scraping content from business listings (at least on Google's domains) to fill your infowindows is against the terms of service.

Here is a basic example:

http://code.google.com/apis/maps/documentation/javascript/examples/place-details.html

Upvotes: 2

Cheery
Cheery

Reputation: 16214

This is how I've done it on map on my site (opens this type of the popup by default): in the initialization function I wrote

map.openInfoWindow(new GLatLng(coordinates), 'html code for the text in window');
var baseIcon = new GIcon(G_DEFAULT_ICON);
baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
baseIcon.iconSize = new GSize(20, 34);
baseIcon.shadowSize = new GSize(37, 34);
baseIcon.iconAnchor = new GPoint(9, 34);
baseIcon.infoWindowAnchor = new GPoint(9, 2);

But this one is only for the map on your website. For the general data in Google, available to everyone, it is not so simple, of course ) For your business to appear on the map you have to go here http://www.google.com/local/add/businessCenter or read this link http://support.google.com/adwords/bin/answer.py?hl=en&answer=143287

Upvotes: 0

Related Questions