ok. Here is my code:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: Map Geolocation</title>
<link href="http://code.google.com/apis/maps/documentation/javascript/
examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?
sensor=false"></script>
<script type="text/javascript" src="http://code.google.com/apis/gears/
gears_init.js"></script>
<script type="text/javascript" >
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var geocoder; //Global GeoCoder.
var map; //Global Map.
//....Initialize Map.
function initialize(Latitude, Longitude)
//======================================
{
geocoder = new google.maps.Geocoder();
//alert("hello");
var myLatlng = new google.maps.LatLng(Latitude, Longitude);
var myOptions = {
zoom: 10,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new
google.maps.Map(document.getElementById("map_canvas"), myOptions);
map.setCenter(myLatlng);
var pString = myLatlng.lat() + ", " + myLatlng.lng();
var infowindow = new google.maps.InfoWindow(
{ content: pString
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
icon: 'http://google-maps-icons.googlecode.com/files/
housesolarpanel.png',
mapTypeId: google.maps.MapTypeId.ROADMAP
});
google.maps.event.addListener(marker, 'click', function () {
infowindow.open(map, marker);
});
// DisplayDirection(37.77493, -122.419418, 37.69489, -122.471);
}
//....Add Marker.
function AddMarker(Latitude, Longitude,PhoneNumber,Email,Address)
//===============================================================
{
var location = new google.maps.LatLng(Latitude, Longitude);
var marker = new google.maps.Marker({
position: location,
map: map,
icon: 'http://google-maps-icons.googlecode.com/files/
golf.png',
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var pString = location.lat() + ", " + location.lng();
var infowindow = new google.maps.InfoWindow(
{ content: pString
});
google.maps.event.addListener(marker, 'rightclick', function
() {
infowindow.open(map, marker);
});
google.maps.event.addListener(marker, 'click',
function ()
{
var str = "navigate," + PhoneNumber + "," + Email + "," +
Address + ","
+ Latitude + "," + Longitude;
window.external.notify(str);
}
);
}
function FitBounds(Lat_SW,Long_SW,Lat_NE,Long_NE)
//===============================================
{
var southWest = new google.maps.LatLng(Lat_SW, Long_SW);
var northEast = new google.maps.LatLng(Lat_NE, Long_NE);
var bounds = new google.maps.LatLngBounds(southWest,
northEast);
map.fitBounds(bounds);
}
//....Get Geo Address.
function GeoAddress(Latitude, Longitude)
//======================================
{
var latlng = new google.maps.LatLng(Latitude, Longitude);
geocoder.geocode(
{ 'latLng': latlng },
function (results, status)
{
if (status == google.maps.GeocoderStatus.OK)
{
if (results[2])
{
window.external.notify(results[2].formatted_address);
}
else
{
alert("No results found");
}
} else {
alert("Geocoder failed due to: " + status);
}
}
);
}
function DisplayDirection(Lat_Org,Long_Org,Lat_Dest,Long_Dest)
//============================================================
{
var myLatlng = new google.maps.LatLng(Lat_Org, Long_Org);
var myOptions = {
zoom: 10,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new
google.maps.Map(document.getElementById("map_canvas"), myOptions);
//map.setCenter(myLatlng);
var latlng_Org = new google.maps.LatLng(Lat_Org, Long_Org);
var latlng_Dest = new google.maps.LatLng(Lat_Dest, Long_Dest);
directionsDisplay = new google.maps.DirectionsRenderer();
directionsDisplay.setMap(map);
var request = {
origin: latlng_Org,
destination: latlng_Dest,
travelMode: google.maps.DirectionsTravelMode.WALKING
};
directionsService.route(request, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
</script>
</head>
<body>
<div id="map_canvas"></div>
</body>
</html>
On Sep 10, 4:18 pm, Rossko <[email protected]> wrote:
> > I have sent my html page to you.
>
> No thanks.
> Put it up somewhere public if you want other people to take a look and
> offer help.
--
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 [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-js-api-v3?hl=en.