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

Isometric illustration comparing a packaged SaaS AI agent box on the left with a custom modular agent stack on the right, deep navy background with teal and orange accents

Custom AI Agent vs Off-the-Shelf Tools: How to Decide

Founders and CTOs face the same choice in late 2026: buy an off-the-shelf AI agent from platforms such as Salesforce…

Shafeeq Khan
October 16, 2026
An AI agent sending trace spans for each model call and tool step to an observability dashboard

AI Agent Observability: How to Trace and Debug Your Agents

On 14 October 2026, Anthropic announced OpenTelemetry tracing for agents built on the Claude Platform, so every agent turn, model…

Shafeeq Khan
October 15, 2026
Isometric illustration of an AI-powered fintech app connected to payment cards, a security shield, an AI chip and a verified AI agent payment token

AI for Fintech Apps: Use Cases, Guardrails and What to Build

On 13 October 2026, American Express published a framework to stop AI agents from making purchases a customer never approved,…

Shafeeq Khan
October 14, 2026
,

Leave a Reply

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