Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

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.

share|improve this answer
up vote 2 down vote accepted

There is a great geocoder already developed for Leaflet.

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

You can use the results easily like

map.on('geosearch_showlocation', function (result) {
    L.marker([result.x, result.y]).addTo(map)
});
share|improve this answer
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
    
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
    
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

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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