Valentino
Valentino

Reputation: 2135

Get latitude and longitude from address with leaflet

In my project I am using leaflet.

I am getting addresses from my database (in array with php) and want to show latitude and longitude associated to each address.

I know there is a great geocoder developed for Leaflet:

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

but I don't konw how to use it for my purpose.

Can anyone help me on this?

Any help would be gratly appreciated.

Upvotes: 0

Views: 3030

Answers (1)

Marko Letic
Marko Letic

Reputation: 2550

I would advise on using http://open.mapquestapi.com/nominatim/

There you will have an example of how to create a query and you will see the look of the response you will get. The are basic simple search examples and the look of the code that runs it. Inside of the response you will have the lat/lon pair so you can use that to draw the marker on your map in Leaflet.js

Upvotes: 2

Related Questions