How to set position of infowindow ?

1,138 views
Skip to first unread message

Tygas

unread,
May 31, 2011, 9:57:23 AM5/31/11
to google-map...@googlegroups.com
I had such case:


function load()
{
// Create new map object
map = new GMap2(document.getElementById("map"));

// Set map center location
map.setCenter(new GLatLng(63.13450320833446,16.69921875), 3);

// Add Map Controls
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());

// Create new geocoding object
geocoder = new GClientGeocoder();
var bounds = new google.maps.LatLngBounds();

// Download the data in data.xml and load it on the map.
// GDownloadUrl("http://esmd.info/index.php?file=map&MAP", function(data) {


GDownloadUrl( "data.php", function(data) {
xml = GXml.parse(data);
markers = xml.documentElement.getElementsByTagName("marker");
name = [];
for (var i = 0; i < markers.length; i++) {
address = markers[i].getAttribute("address");
name[address] = markers[i].getAttribute("name");
var uid = markers[i].getAttribute("uid");

markerId = "id_"+i;

// vardas = "<div id="+markerId+">"+name+"</div>";

geocoder.getLocations(address, addToMap);


var point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));

}
});
}


function addToMap(response )
{

// Retrieve the object

place = response.Placemark[0];

// Retrieve the latitude and longitude
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);



marker = new GMarker( point );

GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml( name[response.name] +' ' + response.name );


});


map.addOverlay(marker);


}




Chris Broadfoot

unread,
May 31, 2011, 8:01:17 PM5/31/11
to google-map...@googlegroups.com
You probably want the V2 group instead:
--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.



--
http://twitter.com/broady
Reply all
Reply to author
Forward
0 new messages