Google geocoding API service resolution address for Android (keywords: Android/GPS/geocoding API/getlocationfrom () return NULL)

Source: Internet
Author: User
Tags reverse geocoding

Keywords: Android/GPS/geocoding API/getlocationfrom () return null

 

 

I plan to develop a program for address location resolution. The following methods are widely used on the Internet:

The getfromlocation () and getfromlocationname () functions are quite popular and informative.

For details, see the following link:

Geographic and anti-encoding of Android maps:

Http://www.eoeandroid.com/thread-63307-1-1.html

 

However, I found that the key step getfromlocation ()/getfromlocationname () returned the null value. A search on the Internet found that many people also experienced similar situations:

Http://www.eoeandroid.com/forum.php? MoD = viewthread & tid = 59961 & page = 1 # pid652205

 

 

Nothing !!!!!!

 

 

After reading the document, I found that Google was joking with us:

 The geocoder class requires a backend service that is not supported in the core Android framework. the geocoder query methods will return an empty list if there no backend service in the platform. use the ispresent () method to determine whether a geocoder implementation exists. <br/>

 

It's really cool!

 

 

So I began to find another way:

Http://www.eoeandroid.com/thread-64115-1-1.html

Thanks to the second floor!

 

 

So I came to the Holy Land in my heart:

Http://code.google.com/intl/zh-CN/apis/maps/documentation/geocoding/

Almost?

 

 

Not enough. The fields parsed by Google map are somewhat different from those described in the above link. The relationship between the specific address and the hierarchical location is as follows:

 // Address = countryname + administrativeareaname + localityname + thoroughfarename <br/>

The location of the country, province, city, and city respectively;

 

 

There is also an accuracy byte that represents the precision, which varies with the input latitude and longitude values;

 

For example:

Http://ditu.google.com/maps/geo? Q = your latitude, your longpolling & Output = xml & OE = utf8 & HL = ZH-CN & sensor = true & Key = your map apikey

Among them, HL = ZH-CN indicates that Chinese characters are returned. If this constraint is met, an English address is returned.

 

There are also some prerequisites for using Google map to parse addresses:

There are limits on the use of the Google geocoding API, that is, 2,500 geographic location query requests per day. (Google Maps API premier users can execute a maximum of 100,000 requests per day .) This restriction is enforced to prevent abuse and/or reuse of the Google geocoding API. This restriction may be changed in the future without further notice. In addition, we have set a request rate limit to prevent misuse of this service. If you exceed the 24-hour limit or abuse this service, Google geocoding API may suspend your service. If you ignore this restriction, your access to Google geocoding API will be blocked. <Br/> note: the Google geocoding API can only be used with Google maps. It cannot only parse addresses, but not display results on maps. For more information, see Google Maps API Terms of Service licensing. <Br/>

 

"If you exceed the 24-hour limit or abuse this service, Google geocoding API may suspend your service. "

What does this sentence mean! Is the total time for developers to use this service no longer than 24 hours?

One caveat before we get started: reverse geocoding is very resource intensive on Google's side, and they will block your api cils if make too your requests within a certain amount of time. so, you want to make sure your application doesn't fire requests too frequently-for my example I only send the request when users press a button. <br/> 

The above instructions from: http://www.smnirven.com /? P = 39

Generally, an IP address cannot frequently send requests to the server within a short period of time. Otherwise, the Resolution Service will be disabled for the application!

 

However, this restriction applies to a single IP address, so we can use client address resolution to ensure that these restrictions are applied to each user separately, rather than the total number of requests generated by all users. If the server sends a request, the request result can be cached on the server to respond to the client request!

Http://hi.baidu.com/zdz8207/blog/item/a110830a6850c92ab0351d4a.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.