";*/ //below array is used to map distance and period with actual record data.push(results[i]); createMarker(results[i]); } //geocoder to find distance and period var geocoder = new google.maps.Geocoder; //passing all destination to geocoder var service = new google.maps.DistanceMatrixService; service.getDistanceMatrix({ origins: origins, destinations: destinations, travelMode: 'DRIVING', unitSystem: google.maps.UnitSystem.METRIC, avoidHighways: false, avoidTolls: false }, function(response, status) { if (status !== 'OK') { console.log('Error was: ' + status); } else { var originList = response.originAddresses; var destinationList = response.destinationAddresses; var outputDiv = document.getElementById('output'); //outputDiv.innerHTML = ''; //deleteMarkers(markersArray); //code to display marker on the map with relavent icon var showGeocodedAddressOnMap = function(asDestination) { var icon = asDestination ? destinationIcon : originIcon; return function(results, status) { if (status === 'OK') { map.fitBounds(bounds.extend(results[0].geometry.location)); markersArray.push(new google.maps.Marker({ map: map, position: results[0].geometry.location, icon: icon })); } else { console.log('Geocode was not successful due to: ' + status); } }; }; for (var i = 0; i ' + address.name + ' ' + results[j].distance.text + ' (' + results[j].duration.text + ')'; /*result_html += "
"; result_html += '
'; result_html += '
' + place.name + '
'; result_html += '
' + results[j].distance.text + ' ' + results[j].duration.text + '
'; result_html += "
"; result_html += "
"; result_html += data[j].vicinity; result_html += "
";*/ /*geocoder.geocode({'address': destinationList[j]},showGeocodedAddressOnMap(true)); outputDiv.innerHTML += originList[i] + ' to ' + destinationList[j] + ': ' + results[j].distance.text + ' in ' + results[j].duration.text + '
';*/ } $("#" + current_placediv_id).html(result_html); } } }); } } function createMarker(place) { var placeLoc = place.geometry.location; var icon = { url: place.icon, // url scaledSize: new google.maps.Size(16, 16), // scaled size origin: new google.maps.Point(0,0), // origin anchor: new google.maps.Point(0, 0) // anchor }; var marker = new google.maps.Marker({ map: map, position: place.geometry.location, icon: icon, }); markers.push(marker); google.maps.event.addListener(marker, 'click', function() { if(typeof infowindow !== "undefined") { infowindow.close(); } infowindow = new google.maps.InfoWindow(); infowindow.setContent(place.name + "
" + place.vicinity); infowindow.open(map, this); }); } function setMapOnAll(map) { for (var i = 0; i
Enquiry
move to top