Click on map and get Longitude -Latitude.

Map

Click on map and get Longitude -Latitude.

How To Get Longitude – Latitude When Clicked On Map?


<div id="MyMap" style="width:100%;height:500px;"></div>
<script>
function myMap() {
  var mapCanvas = document.getElementById("MyMap");
  var myCenter=new google.maps.LatLng(51.508742,-0.120850);
  var mapOptions = {center: myCenter, zoom: 5};
  var map = new google.maps.Map(mapCanvas, mapOptions);
  google.maps.event.addListener(map,'click', function(event) {
    LocationMarker(map, event.latLng);
  });
}
function LocationMarker(map, location) {
  var marker = new google.maps.Marker({
    position: location,
    map: map
  });
  var infowindow = new google.maps.InfoWindow({
    content: 'Latitude: ' + location.lat() + '<br>Longitude: ' + location.lng()
  });
  infowindow.open(map,marker);
}
</script>

<script src="https://maps.googleapis.com/maps/api/js?key=YourKey&callback=myMap"></script>
//Get API key from Google.
//Read more at: https://developers.google.com/maps/documentation/javascript/get-api-key

Shiv kumawat

Executive Director & CEO

"Shiv kumawat is the Executive Director and CEO of Eoxys It Solution LLP and the strategic mind behind the company"s growth. His expertise in operational efficiency and team leadership empowers his colleagues to excel and innovate.”

Latest Posts

Reinventing Everyday Life: The Rise of Artificial Intelligence in Finance for 2025

  Reinventing Everyday Life: The Rise of Artificial Intelligence in Finance for 2025 A New Financial Landscape Artificial intelligence isnʼt…

sakshi
August 14, 2025

AI in Retail USA Redefining Shopping, Operations, and Experiences in 2025

  AI in Retail USA: Redefining Shopping, Operations, and Experiences in 2025 How Artificial Intelligence Is Changing Retail in the…

sakshi
August 11, 2025

AI in Healthcare USA Transforming Patient Care and Operations in 2025

  AI in Healthcare USA: Transforming Patient Care and Operations in 2025 The Rise of AI in Healthcare Across the…

sakshi
August 7, 2025
, ,

Leave a Reply

Your email address will not be published. Required fields are marked *