Where is the iPhone buried or how accurate is GPS?

    Normal accuracyWe planned to create an application for search games - games in which you need to find places in the real world.
    The first thing we needed was an accurate tool for collecting points and creating routes. A simple indication of them on the map did not fit, because the error of the geotags reaches 200 meters - a person could come along the coordinates in search of a small thing, but it turned out that there were still hundreds of steps to the place. In order not to force users to roam, it was decided to develop a system for taking coordinates by phones right on the spot.
    Having experience developing such a system for Android and having suffered with its geolocation services, we suggested that it would be easier to do it on iOS (iPhones seem to be very similar) and more precisely (ideally, we should not be afraid to drop an iPhone in the forest, so that we can find it later compass).
    To test these assumptions, we wrote a prototype that led the user with an arrow to the location, and at the same time made interesting conclusions about the accuracy of the built-in compass and GPS.

    Coordinate accuracy

    Our tests showed that the maximum accuracy of GPS on different iPhones is different, after all, chip manufacturers are not standing still.
    Here is the maximum accuracy we obtained under good reception conditions:
    • iPhone 3Gs - 17m,
    • iPhone 4 - 10m
    • iPhone 4s and 5 - 5m (does GLONASS really affect ?!).

    We asked this accuracy from the phone itself through location.horizontalAccuracy, and we got the location from the LocationManager with the maximum accuracy and refresh rate. All this is pretty well consistent with reality.
    Many instructions write that good conditions also imply the absence of trees. But our tests in the summer in the coniferous-deciduous forest did not show any noticeable deviations.
    It was interesting to understand how iPhones give coordinates where GPS is not received. No surprises happened here.
    There are many good articles that describe how GPS and geolocation work in smartphones in the absence of GPS.
    Example from Yandex .

    It turns out that when the phone does not pick up GPS, then ± 1414 meters are displayed in location.horizontalAcuracy using information from the operator’s base station. Such accuracy is produced by GSM networks.
    If there are Wi-Fi points nearby, according to which geographical coordinates are set, then, as a rule, accuracy increases to hundreds of meters, if there is only one Wi-Fi point, or tens of meters if there are several.

    We did not notice the difference between the iPhone 4S and 5, but we noticed that they update location much more often. Therefore, approaching the captured point, you can see how the figure decreases, showing the distance to the target (30, 29, 28 ...). This creates a pleasant feeling of success.


    imageFurther, in order to bring a person to a place, in addition to the coordinates of the destination, you also need to know the direction in which to go. We do not consider the task of guiding a person through a transport network, as navigators do, we solve the problem of bringing a person to a place, even if we do not know anything about the surrounding transport networks.
    Information about the orientation of the phone relative to the North Pole is used to display an arrow pointing to a place. This information is given by the compass of the device, which appeared in iPhones, starting with 3GS.

    On this we built a compass navigator, the arrow of which indicates a place.

    What can be improved

    Interestingly, the accuracy of the compass is the bottleneck of the entire direction indicating system.
    We can arbitrarily know exactly what course we are moving at the moment, but in order to show this information to the user in the form of an arrow, it is necessary to understand as accurately as possible the orientation to the north of the device itself. Although the compass does not have zones where it does not work, it readily reacts to various interferences and anomalies, as well as the tilt angles of the device, and this is especially noticeable in movement. We decided to fight this problem.
    To clarify, we used the directional angle, or location.course, in terms of the iOS API. This has greatly increased the accuracy of the compass in motion.

    But there were problems. The amendment works on the assumption that people walk with the phone, holding it with the top side forward (according to the results of various experiments, we realized that this is really the case for walking iPhone breeders). But if a person is traveling by car or public transport, then the situation when the phone is located sideways relative to the direction of movement occurs much more often. Therefore, the amendment must be disabled:
    • at high speed (because the phone quickly flies over different interferences and anomalies and reacting to them means creating interference over interferences);
    • if the amendment is more than 75g. (since here you already have to shrug, it is hardly possible to offer something more accurate).

    There are, of course, more sophisticated methods for refining the readings of the arrow - you can implement a real dead run (link that I have not yet found). But we hope that iron producers will better solve this problem. And our testing showed that the compass pointer with small software corrections fulfills its function - it brings a person to the place.


    To verify the accuracy of the prototype, we decided to conduct a small experiment (oh, how many experiments we did).

    Belief in the reliability of the developed prototype caused controversy in the team. Therefore, the colleague who believed most in him (he developed it), dared to bury his iPhone in the forest as proof of its reliability (nothing unusual, everyone does that). He left with two devices, took a seat and, returning, gave one iPhone to me.
    I walked through the forest, following the arrow on the screen. When the screen showed the remaining distance of 0 meters, I looked down and saw a photographed place. It turned out that a colleague still decided not to risk his phone, but planted a dummy (villain), but the experiment was certainly a success.


    This prototype turned out to be a useful application for sharing places, but it is the topic of another post.

    A small addition, in response to the comments received.

    We did not seek to compare the readings of the iPhon GPS with any reference values.
    We tried to evaluate the results obtained from different iPhones that were in the same situation, but at different times.
    We examined how the results of the first measurement differ from the results of subsequent ones made on similar or identical phones.
    Dozens of tests have been conducted under various conditions. Briefly summarize the experience gained in two sentences:
    1. If you take the coordinates on one phone, and come to them using another, then under good conditions, you will be at a distance of 3-10m from the target.
    2. The value of location.horizontalAccuracy accurately reflects reality, assuming that it shows the maximum distance to a point received using another phone.

    Also popular now: