3

In my project I am using leaflet to display points. I am getting address from my database & want to show point for that particular address. I dident found anything which will give me latitude & longitude as per address provided. Can any one help me on this.

7

What you want to do (Convert address to a position) is called Geocoding. To get a a location for your address, you need a Geocoder.

Your Options are rather limited when you are working in the FOSS world. You main options are Nominatim & MapQuest's Open Geocoding Service

if you were working with Google's Map API, you could have used their Geocoder. And If you were using ESRI software, you could use the geocoder available at ArcGIS Online.

You need to remember that the geocoding can only be as good as the data it is running on. In Areas where the data is patchy, or complete geocoding is not possible, you will get bad or 0 results.

3

There is a great geocoder already developed for Leaflet.

You can use the results easily like

map.on('geosearch_showlocation', function (result) {
    L.marker([result.x, result.y]).addTo(map)
});
  • 3
    While it's great that you are doing research on your own and posting an answer here, let me warn you that if you use the ESRI provider or Google provider, you will be breaking the T&C of both the service providers. It's best to always check the T&C of any service provider before using it. – Devdatta Tengshe Apr 10 '13 at 11:41
  • 1
    I didn't got you. What you want to say ? – vaibhav shah Apr 10 '13 at 11:43
  • Googles says that you are allowed to you their geocoder only if you use their API on the Same Page. ArcGISOnline also has certain Terms and Conditions, which will not be met if you are calling their geocoder from this library. SO if you use this library, yes you might be getting results, but you are breaking the rules set by these providers and that is not a good thing to do. They could block your IP/Application or even sue you if necessary. – Devdatta Tengshe Apr 10 '13 at 11:45
  • 1
    Like vaibhav shah said. L.GeoSearch works great. I use the Bing address search engine. It puts the point in the middle of the parcel most of the time. – geomajor56 Apr 12 '13 at 17:27
0

I have got the same feature in my project and I use the leaflet-control-bing-geocoder:

https://github.com/sa3m/leaflet-control-bing-geocoder1

Bing allows you to use its geocoding service outside Bing Map but you will need a key to access to it. There is a free trial of 90 days then you will have to purchase a public or enterprise license. This key allows you to use Bing layers in your project as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.