About the coordinate system problem with Android positioning

Source: Internet
Author: User

According to the normal thinking, we can obtain the latitude and longitude information by GPs or base station positioning, and then put it on the map to complete the positioning. In practice, however, we are likely to find that there is a large offset in our positioning. This is because our country, for national security (or ¥@#%¥##), will convert all electronic maps into a line-biased process, from a real geographic coordinate system called the Earth Coordinate system (WGS84) to a Mars coordinate system (GCJ02). This is the reason why we locate the offset, and also the source of the coordinate system problem.

So how do we deal with the coordinate system problem? Take our usual Baidu and the German map API as an example to illustrate. The coordinate system of Baidu map is the BD09 coordinate system which is self-encrypting on the basis of Mars coordinate system, and the coordinate system of the German map is the common Mars coordinate system GCJ02. Then very good understanding, since Baidu Map is BD09 coordinate system, then through the Baidu Map API obtained latitude and longitude is also BD09 coordinate system, direct display, no problem; Similarly, the latitude and longitude obtained through the German map API must be GCJ02, which can be displayed directly on the top of the German map. But if we do not call the third-party map API, but instead use the latitude and longitude obtained by the android.location, or the latitude and longitude obtained by hand-held or in-car GPS terminals, that is the real geographical coordinates belonging to WGS84, this time, Directly on the Baidu or high-German map shows that there will be an offset

So, how to do when the latitude and longitude are inconsistent with the coordinate system of the map? The best approach is to call the coordinate system transformation interface provided by the service provider of the map you are using, possibly a paid interface. It is not recommended to use the Earth coordinate system and Mars coordinate conversion algorithm which is widely circulated on the Internet, and the measured error is large. If, in fact, there is no way, in a small area, the latitude and longitude to add a fixed correction value, but also reluctantly available. Note that it is a small area, because the bias is not linear, but the offset of a certain range will not be too large, through a fixed correction value, or can improve the positioning accuracy in a small range. As to how this range is determined, I do not know ...

About the coordinate system problem with Android positioning

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.