Click on map and get Longitude -Latitude.

Map

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
Click on map and get Longitude -Latitude. – screenshot 1

Related reading:

Shiv Kumawat

Executive Director & CEO

Shiv Kumawat is the CEO of Eoxys IT Solution LLP, the Jaipur-based IT company he has led since 2009. An AI & IT Solutions Consultant with 16+ years of experience, he works with startups and enterprises to turn ideas into market-ready SaaS platforms, mobile apps and AI-driven solutions. His team has delivered 700+ projects across SaaS, mobile and web apps, automation and AI. He previously served as Chief Technology Officer for a US company.

Latest Posts

AEO vs SEO vs GEO: a search bar above an AI answer panel that cites three web sources

llms.txt and AI Crawlers on WordPress: What to Allow in 2026

Many WordPress owners have heard they need an llms.txt file to show up in ChatGPT or Google’s AI answers. Others…

Shafeeq Khan
November 5, 2026
WhatsApp AI chatbot illustration: a phone chat and a larger chat window with bot replies and customer messages

AI Chatbot Development Cost in 2026: India vs US vs UK

Ask five vendors for a quote and the AI chatbot development cost can range from a few hundred dollars to…

Shafeeq Khan
November 4, 2026
AEO pricing illustration: cost charts and an AI search panel on an isometric navy platform

AEO Pricing in 2026: What AEO and GEO Services Cost

If you have asked two or three agencies for an AEO or GEO proposal, you have probably seen very different…

Shafeeq Khan
November 3, 2026
,

Leave a Reply

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