1

First of all, I am familiar with Geocoder and Places API. For this reason, I do not ask about how can I get the whole address in the raw format by using these. I am looking for getting the formal address of somewhere. Since the places that can be getatable with Geocoder API is not organized, I could not reach provinces of two different LatLng value by calling the same place unit. To exemplify, I can get the city corresponds to my current location by calling .adminArea() but my friend's location may be returned as his hood from .adminArea(). Thus, I could not get the string of city from Geocoder object although the address of this object contains the name of the city.

Is there another API that can give me the correct street/locality/city if I call the relavent methods? Or is there a way to parse address of Geocoder object so that I can get the cleanest address components?

Dorukhan Arslan
  • 2,676
  • 2
  • 24
  • 42

2 Answers2

1

You can try some Bing Maps API. It's not an Android API per se, but you can issue requests to the RESTful API and get very standardized results.

This is an example result JSON (only the main part of it is shown below):

"address":{
    "addressLine":"1 Microsoft Way",
    "adminDistrict":"WA",
    "adminDistrict2":"King Co.",
    "countryRegion":"United States",
    "formattedAddress":"1 Microsoft Way, Redmond, WA 98052",
    "locality":"Redmond",
    "postalCode":"98052"
}

Locality is always the City while AdminDistrict is always the State.

PS: I use it in one of my projects, their quotas are very fair.

Paulo Avelar
  • 2,140
  • 1
  • 17
  • 31
  • Unfortunately, my project will be a quota monster. Thus, although it seems as a good alternative, I could not rely on Bing Maps API's request limit. I should continue with Google and find a way to get the address in a proper way. But still your answer is valid. Thanks. – Dorukhan Arslan Aug 28 '15 at 01:43
  • Okay. What amount of requests per day? Because AFAIK Bing's quota is just as high as Google's, 10k requests/month. See this: http://azure.microsoft.com/en-us/marketplace/partners/bingmaps/mapapis/. Also, Google restricts requests per second to 5, while Bing does not. – Paulo Avelar Aug 28 '15 at 01:51
  • Google's limit is 2500 requests per day and per IP. – Dorukhan Arslan Aug 28 '15 at 02:16
0

There are lots of APIs for verifying and parsing addresses into their component parts. Don't try to solve this problem yourself ("step away from those regexes with your hands up!") I'm partial to smartystreets.com and their services, but that's because (disclosure) I'm a developer there and helped build most of them.

Michael Whatcott
  • 5,603
  • 6
  • 36
  • 50