Get latitude and longitude at the address provided for the flyer

In my project, I use flyers to display dots.

I get the address from my database and want to show a dot for that particular address.

I did not find anything that would give me latitude and longitude at the specified address.

Can someone help me with this?

+6
source share
3 answers

There is a large geocoder already developed for Leaflet.

https://github.com/smeijer/L.GeoSearch

You can easily use results like

map.on('geosearch_showlocation', function (result) { L.marker([result.x, result.y]).addTo(map) }); 
+7
source

If you want to use OpenStreetmaps for this, you can just make a query (using jquery):

  $.get(location.protocol + '//nominatim.openstreetmap.org/search?format=json&q='+address, function(data){ console.log(data); }); 

You will get JSON objects containing (and not just) lat and lon.

+3
source

you can use google map api for this purpose. check out this api call example

-1
source

All Articles