Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

121
Views
Get Adress from Latitude And Longitude with Leaflet

im trying to make a map with Leaflet when i search a place it give me the Latitude, Longitude and the adresse of the place,I want to ask if there is a function that let me save the adresse in a variable.

Picture example

Picture exemple

    /*===================================================
                      OSM  LAYER               
===================================================*/
let lat;
let nom;
var  x;
 let lon;
    var map = L.map('map').setView([9.561555499999997,33.892166], 4);
var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
});
osm.addTo(map);
 
map.on('click', function (e) {
    lat=e.latlng.lat;
    
          lon =  e.latlng.lng;
          
          document.getElementById('latitude').textContent = lat;
         document.getElementById('longitude').textContent = lon;
         x=document.getElementById('latitude').innerHTML;
         
});
/*===================================================
                      MARKER               
===================================================*/

var singleMarker = L.marker([28.25255,83.97669]);
singleMarker.addTo(map);
var popup = singleMarker.bindPopup('This is a popup')
popup.addTo(map);

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!