[Solved] Center map on user’s location (Google Maps API v3)

Getting the user location is a browser feature that most modern browsers support. However, you still need to test for the ability to get the location in your code. if (navigator.geolocation) { // test for presence of location feature navigator.geolocation.getCurrentPosition(function(position) { initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude); map.setCenter(initialLocation); }, function() { console.log(‘user denied request for position’); }); … Read more

[Solved] Get latlng and draw a polyline between that two latlng

/*This is script*/ var x=0; var map; var prepath; var path = null; var current_lat = 28.6667; var current_lng = 77.2167; function initialize() { var myLatLng = new google.maps.LatLng(28.6667, 77.2167); var mapOptions = { zoom: 3, center: myLatLng, mapTypeId: google.maps.MapTypeId.TERRAIN }; map = new google.maps.Map(document.getElementById(‘map-canvas’), mapOptions); //alert(“sdf”) google.maps.event.addListener(map, “click”, function (e) { //delete old //alert(“sdf123”) … Read more