7

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.

Prasad Rajapaksha
  • 6,118
  • 10
  • 36
  • 52

2 Answers2

16

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.

scai
  • 20,297
  • 4
  • 56
  • 72
  • 2
    Appreciate your answer. But it looks like OpenStreetMap doesn't have location details than Google for my country. It may have covered main countries. However your answer helped me. FOr the moment I ahave developed combination of Google Places API and reverse geocoding. – Prasad Rajapaksha Sep 12 '13 at 02:08
3

You can brute force the google map api for example you can use an interval of points for example every 8° degree within a certain radius and evaluate the json response from the Google maps geocode API. But the Google map geocode API doesn't support the same feature like the places API because of good privacy reasons. Read here about a similar question: Map of all points below a certain time of travel?.

Community
  • 1
  • 1
Micromega
  • 12,486
  • 7
  • 35
  • 72
  • Maybe you can explain me a) op thinks this doesn't solve his answer b) similarities to your answer? – Micromega Sep 12 '13 at 13:15
  • Sorry, I don't understand your questions. Can you rephrase them? I'm just curious if brute forcing their API is allowed by their terms of service. This hasn't anything to do with my answer. – scai Sep 12 '13 at 13:28
  • The api says it allows X request per day. What's your problem? – Micromega Sep 12 '13 at 13:44
  • My answer has nothing to do with your anwser? Or do you mean Google Api doesn't allow X requests per day? – Micromega Sep 12 '13 at 14:30
  • Again, I just wanted to know _if_ such bulk queries are allowed. If they are then everything is fine. – scai Sep 12 '13 at 14:34
  • I think it's nothing wrong if you don't exceed a certain limit :). But I have asked you a question you didn't understand? You can read about OP's comments and you get 2 upvote for your question? Why? OP says in a comment my answer has nothing to do with it? Why? Or is your comment just a fun comment? I think it's serious issue (and I don't mean GOOGLES terms of service)? – Micromega Sep 12 '13 at 14:54
  • I'm not quite sure what you are trying to tell or ask me. None of my comments or answers are meant as fun. – scai Sep 12 '13 at 17:42