1
    <!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" />
    <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script>
    <style>
        #map {position: absolute; top: 0; bottom: 0; left: 0; right: 0;}
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>
      var map = L.map('map').setView([17.3920179,78.5162559],25);
      L.tileLayer('https://api.maptiler.com/maps/streets/{z}/{x}/{y}.png?key=TYaSC3KW2gZxjgAO3ndB', {
          attribution: '<a href="https://www.maptiler.com/copyright/" target="_blank">&copy; MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>',
       }).addTo(map);
       var popup = L.popup();

       function onMapClick(e) {
           popup
               .setLatLng(e.latlng)
               .setContent("You clicked the map at " + e.latlng.toString())
               .openOn(map);
       }

       map.on('click', onMapClick);
    </script>
  </body>
</html>

How to store my lat lng to a local file after every click?

  • 2
    Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works. – Ian Turton Jul 16 at 16:18
  • 2
    This is not really GIS SE question, data to be saved could come from anywhere. It's more suitable for StackOwerflow site. – TomazicM Jul 16 at 17:14

Browse other questions tagged or ask your own question.