<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/
>
<title>Google Maps Sample Marker</title>
<script src="http://maps.google.com/maps?
file=api&v=2&key=ABQIAAAAH5jQ9DT6jL7GEIxXum7fHhTrMNvYXb78c_EdmlM3I7vddONuCBStV4UbzDy0PTv_k50KjXZE7yXp2w"
type="text/javascript"></script>
<script type="text/javascript">
var map;
var geocoder;
var xml;
var markers;
var address;
//var label;
function load() // On page
load, call this function
{
map = new GMap2(document.getElementById("map")); // Create new
map object
map.setCenter(new GLatLng(39.969036, -083.011389), 9); // Set map
center location
map.addControl(new GSmallMapControl()); // Add
Map Controls
map.addControl(new GMapTypeControl());
geocoder = new GClientGeocoder(); // Create
new geocoding object
GDownloadUrl("./t1.xml", function(data) {
xml = GXml.parse(data);
markers = xml.documentElement.getElementsByTagName
("marker");
address = markers[0].getAttribute("address");
//label = markers[1].getAttribute("label");
geocoder.getLocations(address, addToMap);
});
}
function addToMap(response) //
This function adds the point to the map
{
place = response.Placemark[0]; //
Retrieve the object
point = new GLatLng(place.Point.coordinates[1], //
Retrieve the latitude and longitude
place.Point.coordinates[0]);
var marker = new GMarker(point); //
Create a marker
map.addOverlay(marker);
marker.openInfoWindowHtml(place.address);
// marker.openInfoWindowHtml(place.label);
// Add the marker to map
}
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 800px; height: 600px"></div>
</body>
</html>
hi Ross
The above code we are trying to get label on the marker.
when we tried we we the marker loaction by we are not able to label
with number.
please help me
Thanks
RAm
On Jan 22, 4:54 pm, Rossko <[email protected]> wrote:
> > but i dont know how to use the above constructor and make the label
> > printed with only address as input
>
> You can't, you must give it a lat/long.
>
> You can't give the usual GMarker constructor an address either.
> Somewhere in your super-secret script, it is doing the geocoding for
> you that converts from address to lat/long. You need to alter your
> secret page so that it uses the geocoded lat/long with the labeled
> marker functions instead of with the regular GMarker.
>
> cheers, Ross K
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---