integrate map using latitude and longitude
function initMap() {
var lat = <?php echo $hotel_details->Hotels->Latitude; ?>;
var long = <?php echo $hotel_details->Hotels->Longitude; ?>;
var lat = <?php echo $hotel_details->Hotels->Latitude; ?>;
var long = <?php echo $hotel_details->Hotels->Longitude; ?>;
var myLatlng = {lat: lat, lng: long};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 12,
center: myLatlng
});
zoom: 12,
center: myLatlng
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Click to zoom'
});
position: myLatlng,
map: map,
title: 'Click to zoom'
});
map.addListener('center_changed', function() {
// 3 seconds after the center of the map has changed, pan back to the
// marker.
window.setTimeout(function() {
map.panTo(marker.getPosition());
}, 3000);
});
// 3 seconds after the center of the map has changed, pan back to the
// marker.
window.setTimeout(function() {
map.panTo(marker.getPosition());
}, 3000);
});
marker.addListener('click', function() {
map.setZoom(12);
map.setCenter(marker.getPosition());
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=YOUR API KEY&callback=initMap">
</script>
map.setZoom(12);
map.setCenter(marker.getPosition());
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=YOUR API KEY&callback=initMap">
</script>
Comments
Post a Comment