Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find addresses within given radius

I have a requirement to find all the addresses within given radius. I have implemented following to get done this.

Google Places API

This only provide business addresses within the radius.And it accept radius as a parameter. https://maps.googleapis.com/maps/api/place/textsearch/json?key=myAPIKey&location=6.914701,79.973085&radius=100&sensor=false&hl=en&query=*

Google reverse geocoding

It's just converting given lat & lng to addresses. This doesn't actually meet my requirement.And it is not accepting radius as a parameter. http://maps.googleapis.com/maps/api/geocode/json?latlng=6.914701,79.973085&sensor=false

Is there any way to get all addresses within given radius. Specially resident addresses.

like image 486
Prasad Rajapaksha Avatar asked Sep 09 '13 02:09

Prasad Rajapaksha


1 Answers

Have you considered using OpenStreetMap for your task? With the help of the Overpass API you can query for all data within a given bounding box. For example this query returns all addresses which have a house number within your mentioned area. It uses the overpass turbo for visualization and the Overpass API only in the background but of course you can also use the Overpass API directly for returning raw data as XML or JSON.

However because your area has only sparsely mapped house numbers in OSM, there isn't much to return yet. Other better mapped areas will work way better but you can try to improve your area if you want.

For more information about how to modify the given query take a look at commonly used tags and the Overpass API language guide.

like image 55
scai Avatar answered Sep 30 '22 13:09

scai