var map;
function initialize1() {
var mapOptions = {
zoom: 15,
mapTypeId: google.maps.MapTypeId.SATELLITE,
mapTypeControl: false
}
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
// Try HTML5 geolocation
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var pos = new google.maps.LatLng(position.coords.Latitude ,
position.coords.Longitude);
var infowindow = new google.maps.InfoWindow({
map: map,
position: pos,
content: 'Location found using HTML5.'
});
map.setCenter(pos);
}, function () {
handleNoGeolocation(true);
});
} else {
// Browser doesnot support Geolocation
handleNoGeolocation(false);
}
}
function initialize() {
var mapOptions = {
zoom: 6
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
// Try HTML5 geolocation
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var latlongs = {!Station__c.LocationCoordinates__Latitude__s }; //position.coords.latitude position.coords.longitude
$("#.00ND0000004eEjCj_id0_j_id26_j_id27_ileinner");
var longtudes = {! Station__c.LocationCoordinates__Longitude__s};
var pos = new google.maps.LatLng(latlongs, longtudes );
var infowindow = new google.maps.InfoWindow({
//map: map,
//position: pos,
content: 'Location found using HTML5.'
});
var marker = new google.maps.Marker({
position: pos,
map: map
});
map.setCenter(pos);
google.maps.event.addListener(marker, 'mouseover', function() {
infowindow.open(marker.get('map'), marker);
});
google.maps.event.addListener(marker, 'mouseout', function() {
infowindow.close();
});
}, function () {
handleNoGeolocation(true);
});
} else {
// Browser doesnot support Geolocation
handleNoGeolocation(false);
}
}
function handleNoGeolocation(errorFlag) {
if (errorFlag) {
var content = 'Error: The Geolocation service failed.';
} else {
var content = 'Error: Your browser doesnot support geolocation.';
}
var options = {
map: map,
position: new google.maps.LatLng(60, 105),
content: content
};
var infowindow = new google.maps.InfoWindow(options);
map.setCenter(options.position);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
Hi Manju,
Programmatic questions are best posted at developer boards as this community is only focused on setup and configuration.
https://developer.salesforce.com/forums/#!/feedtype=RECENT&criteria=ALLQUESTIONS (https://developer.salesforce.com/forums/#!/feedtype=RECENT&criteria=ALLQUESTIONS)
https://salesforce.stackexchange.com
Thanks,
Pritam Shekhawat