// To get current location from network
navigator.geolocation.getCurrentPosition(function(currentLocation) {
// success
},
function() {
// error
}
);
// Google call to render MAP.
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644),
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL
},
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_area'), mapOptions);
// Reverse Geocode - get address from lat long.
(new google.maps.Geocoder()).geocode({latLng: latLng}, function(resp) {
if (resp[0]) {
for (var i = 0, I = resp[0].address_components.length; i < I; ++i) {
var component = resp[0].address_components[i];
if (contains(component.types, 'political')) {
....
}
}
}
});