Using geocoding to do the Yi of latitude and longitude

Source: Internet
Author: User

---restore content starts---

Basic Android itself with the Geocoder this class can also be achieved for the latitude and longitude of the positive and negative Yi, but its own bugs exist a lot, especially in the stability of the resolution here, Google provides geocoding stability more good, although its usage is a little more complex, In fact, its general working principle is the HTTP protocol, Google has an open interface, we will be the latitude and longitude as a parameter to the Google server, and then it will parse the good data back to us

Its interface format is as follows:

Http://maps.googleapis.com/maps/api/geocode/json?latlng=40.90,-74.9&sensor=true_or_false

From HTTP to geocode/are fixed addresses, and the back of the JSON represents the returned data format, XML is also OK, and then clear, you want to parse the latitude and longitude value is what you

Fill in what is, the back is to determine whether the request from the device's sersor, generally set to false on it

Well, we'll get this JSON-formatted data:

"Formatted_address": "277,"

The parsing of JSON data is simple, but if Google is blocked, there is no way, the recent attempt to find that Google Server has been connected, can only continue to wait a few days to try a better

The code for the test is as follows:

---restore content ends---

Using geocoding to do the Yi of latitude and longitude

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.