core location constants meaning - ios

I am very confused about the meaning of the core location constants. For example for my app I would like to get accuracy readings within 100 meters and it looks like kCLLocationAccuracyHundredMeters would be the appropriate choice. However with this settings I often get points with accuracy worse than +- one thousand meters and when I disable wifi. Are these core location constants only relevant when wifi is enabled or does it sound like I am doing something wrong? It seems weird that Apple wants developers to not have to worry about the underlying hardware (i.e. whether it is using gps, wifi, or cell towers) but have the accuracy totally depend on wifi being enabled.
Thanks for your help.

GPS readings depend on a LOT more than just your accuracy setting. For example if you are not using wifi and you try to take a reading from indoors I have seen GPS be several thousand meters off consistently until you go outside. If you are planning on making your app accurate for indoors I would not plan on relying on the typical GPS. If your major use case is outside than GPS is VERY accurate.

The accuracy constants are how you "request" a specific accuracy. What you actually get depends on what is available. CL will try to give you your requested accuracy (or better) but it will give you what it has even if it is worse accuracy while it is trying to get better accuracy location.
If you wait long enough (and ignore the locations that aren't good enough) then you will eventually get better accuracy location unless it can't be done (such as when GPS satellites aren't visible or there is no WiFi, etc).

Related

iOS Mapbox accuracy issue with no cellular data?

seems like accuracy of the user location is somewhat of when cellular data is not available?
Can I adjust how often user location is updated? Is there an example of user location adjustment to streets/roads/driveways? As you can see below line is way off the road.
.
Is geolocation accuracy affected when cellular data is not available?
Sometimes. The GPS source specifically does not depend on cellular, but positions are ultimately provided by the OS, which may use cell towers and nearby wi-fi when available to refine the location.
I don't know the scale of your map apart from using the cars/trucks on the pictured main road as references, but the distances involved appear large enough that the absence of cellular should not cause large jumps (but probably noisier lines).
Can I adjust how often user location is updated?
Indirectly, but yes. You can play with the desiredAccuracy, distanceFilter and activityType properties of the MGLLocationManager (accessible as the locationManager property of your MGLMapView).
The idea is to reduce the desired accuracy and distance filter so that you get noisier but more frequent positions. Setting activityType to CLActivityType.fitness might help as well.
Is there an example of user location adjustment to streets/roads/driveways?
You can check out Mapbox's Map Matching API, which is powered by the matching service of the OSRM (Open Source Routing Machine) engine.

Does iPhone/iPad use GPS and GLONASS in the same time? Can I manage them?

I know that iPhone/iPad could use GPS and GLONASS, but does they use they in the same time?
I didn't find that info in documentation. GPS demand 4 satellites for proper work, (3 without altitude). Same thing with GLONASS. So, if we use just GPS we get 4 satellites and get's our standard GPS accuracy, and it's tolerance about 10-20 meters in open sky. I didn't find specified accuracy on wiki GPS page, maybe I just missed, but anyway my numbers is close. As said wikipedia, GLONASS accuracy for civilian usage is very slightly less accurate than GPS, but on high latitudes (north or south), GLONASS' accuracy is better than that of GPS due to the orbital position of the satellites. GLONASS
So, if we use both systems simultaneously, we have a great accuracy improvement because we have 8+ satellites from both systems. My question is: does iPhone/iPad use both systems and their location coordinates still sometimes very inaccurate? Is there a way to turn on/off one of the systems?
iOS locates the current location with all available services. That means GPS, mobile telephony transmitters (mobile cells), WLAN, and the newer iPhone with GLONASS. We have no way to decide programmatically which system exactly we want to use, but there are different ways to use the iOS location services. The desired accuracy and other parameters can be set via the CoreLocation Framework classes.
You should read the Location Awareness Programming Guide from Apple.
The main advantage of using GLONASS together with GPS is in situations with bad view to the sky, e.g., in urban canyons.
In that case, the additional GLONASS satellites may help.
In open sky situations, a combined GPS/GLONASS has no accuracy benefit to a GPS chip alone.
You cannot switch off any one of the GNSS systems in iOS. (iPhone 4S is the first iPhone that uses combined GPS/GLONASS).

Best practice to implement location based service in iOS

What is the best (meaning least power consumption) way to use some location based service in an iOS application? E.g. checking the position in the background every x sec/min.
I've read about geofencing, but I'm not familiar with it in detail (how often it is updating location etc.).
Thanks for sharing any ideas
There is no best practice, it depends much on your application, which location accuracy it needs. How fast you need a position change, etc.
Either you need to be accurate to under 30m then you need GPS, which uses Power (8h of recording is possible at best location quality without using the phone otherwise)
Or you need much less accuracy, typically 1km, then it works with Cell Tower or Wifi location, which uses less power.
In between there is nothing reliable. (e.g 100m accuracy with low power, does not really exist, at least I would not trust such a setting, there are no published measurements how accurate an iphone really is in the lower accuracy settings).

Determining location with Wi Fi

Is there a way that I can determine a location of a laptop/phone connected to my router via a wireless network access point? (I do not want to use GPS... only the access point).
No. But let's examine why.
If you can get the metrics from the router, which might or might not be possible, you can get the signal strength. This will give you a circle. But, this is limited, as you also need to know how strong the WiFi card is to determine rough distance. But, you probably know the rough distance your router works under, or the max circle, so this is not very useful.
If you have more than one access point, however, you can use triangulation. With two, the information is limited; three or more will give you a more accurate distance and allow you to extrapolate the strength of the signal.
Nope. You might be able to estimate its distance away, but even that is not likely if you're inside a building. Various building materials attenuate the signal, so the response is non-linear. If your router has two separate antennas, and you can measure the signal strengh from each independently, then you might have a chance of getting a feel for the direction, but I doubt the signal resolution will be high enough to give you any meaningful data.
Yes. However you'll need more than one Access Point and some serious software.
There are a number of solutions available and in-development for Location Based Services in Wi-Fi Networks. As Gregory mentioned above a single AP is not enough to do anything but poor range estimation, however multiple APs do not typically use triangulation to determine the location solution, they use a trained Hidden Markov Model.

Finding out distance between router and receiver?

A general question: is it possible to retrieve information about how far away e.g. a computer is from a wifi-router. For instance I want to get data on my computer if I'm 10 meters away from my home-wifispot or 2 meters.
Any idea if that is even possible?
Edit: How about bluetooth? Is it possible to get information about how far away bluetooth-connected devices are one from another?
I would recommend a measuring line or just good-old-fashioned guesstimating.
There is no "simple" way to do it (complex ways may involve building "accurate" signal maps ahead of time or trying to fit a better equation which is still subject to anumber of the limitations with the naive rule) and the rule of thumb "1/r^2" is just that -- a general rule of thumb. On the other hand, perhaps there is some existing software that will show you your RSS strength and make the task feel accomplished :-)
You will find useful links if you google for "RSS signal distance". This kind of task seems quite a common topic in academia w.r.t. small wireless devices ("motes") as well and there have been some interesting approaches to this problem such as the fitting of secondary low-frequency acoustic sensors.
You can query the signal strength which is some kind of indication of distance and obstructions and a few other factors all rolled into one measure. With just plain wifi though this isn't possible directly.
Try measuring the response time of the router to pings, with the data rate set to constant to avoid that effecting the response time. Take lots of samples and remove outliers to reduce errors, but you will still have a substantial quantization error. Subtract the latency of the router and computer, divide by 6 then multiply by the speed of light and hopefully you will have the distance to a resolution of a few metres.

Resources