How to get your exact position and Iphon analysis of the location of the mobile phone application

Source: Internet
Author: User

I believe that most of the app to use the high-German map and Baidu map, and use to get the user's location function. Then you will find that you set the filter accuracy of the map interface, the result you get the location is very inaccurate, often you run on the road, the results in your application to see your car in the river, people in tears. Come on, I'll tell you why. How do you get the exact location of the user?
First, the iphone's GPS positioning in the world to obtain location information, not as hard as Android to enter the room will not be able to locate the location. If you are on the back of a hill on the map can not locate your location, not your map does not receive GPS location information, but your map does not include your coordinates information. This scene I was in Hangzhou Tiger Run after the horse on the hill near the hill test, and then a hill back I wrote the test application received GPS location information, but the great map and Baidu map have no location information. On the head of the Tianzhu Mountain, my mobile phone from 4G to 3G network, I wrote the application received GPS location information, gold map and Baidu map have no location information, Baidu Map can load map finished, great map loading not come out. After testing the iphone app, as long as the network is turned on and the network is turned off later, your mobile app will still receive location information, so the iphone gets GPS location information. Unlike installation is the base station positioning, GPS positioning, network positioning n a variety of situations. However, the accuracy of GPS location information in iOS is still affected by obstacles such as buildings and mountains. If tested in our company's main building 6 upstairs, generally open high-gold map, the accuracy is about 65, then the company outside the gate of the accuracy can reach 10 meters –20 meters.
Take the German map for example:
There are two types of locations where you filter location information: Set the filter distance and set the desired accuracy.
_mapview.distancefilter = 20.0;
_mapview.desiredaccuracy = kcllocationaccuracyhundredmeters;
When you set the filter accuracy, actually when your app starts, there are 3 points that have a precision of more than 20 meters (up to 65 meter accuracy) into the IF (updatinglocation) statement below. is not the position coordinates that you expect, after also has the precision reaches 20 meters –45 meters the point enters inside, therefore is expects? Not reliable.

-(void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocationupdatingLocation:(BOOL)updatingLocation{    if(updatingLocation)    {         //保存位置信息和位置相关操作,如画车子的运行轨迹     }}

To get to the point, how to achieve the accuracy of 20 meters of points, of course, depends on the progress to judge. Note If a region GPS signal is not good, the accuracy can not reach 20 meters of location information, then you may filter out all the location information, then your car in this area will not track. Who let you filter too ruthless! You're too me. I have a temporary human evaporation for some time.
The correct get Location code is:

-(void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocationupdatingLocation:(BOOL)updatingLocation{    if(updatingLocation)    {                                     if(userLocation.location.horizontalAccuracy <= 20.0)            {                //保存位置信息和位置相关操作,如画车子的运行轨迹            }     }}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

How to get your exact position and Iphon analysis of the location of the mobile phone application

Related Article

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.