How does my iPhone get its altitude? - iphone

I made a simple app which displays the altitude according to the GPS position on iPhone.
How is the altitude obtained?
Does it get the altitude of the land at the coordinates I am or does it get the actual altitude? (I tried the same application in the same building; once at ground floor and once on the third floor but the same altitude is displayed)
Is it possible to obtain a different altitude on different floors? (Like my android phone has a barometer sensor and I calculate the elevation by the atmospheric pressure; but none of the iPhones has a barometer sensor)

The altitude as read by the gps receiver depends on the positions of the satellites over the horizon, relative to each other. It is possible then for the altitude reading to be unreliable when either there are not enough satellites in the sky or they are too close together. This then depends on the time of day, or date.
The signals from the satellites are very weak once they have reached the Earth's surface, and may not be received correctly inside buildings, or where there are other tall buildings nearby, such as a city centre like Manhattan.
Barometer readings will vary according to the weather and so an absolute reading can't be applied to a specific floor. However relative readings may be reliable enough for floor to floor changes, e.g. a lower value means going up.

Like any other device that uses GPS to calculate altitude, it's measuring the user's distance from the center of the satellites' orbits.

Your smartphone uses GPS technology to calculate your altitude depending on where you are. It measures how far away you are from the satilites which is calculating this information.

Note that newer IPhones (>= 6) have a barometer sensor which in my experience is significantly more accurate than GPS. With a barometers the accuracy appears to be within a foot whereas with GPS it would bounce around by 3-4 meters even when standing still.
http://www.iphonetricks.org/iphone-6-barometer-sensor-features/

Related

Swift: Coordinates not accurate when using latitude/longitude

I'm using the CLLocationManager in Swift.
When I display location.coordinate, it provides me with the result:
37.787358900000001, longitude: -122.408227
However, if I display. location.coordinate.latitude, the result is
37.7873589
Do you know how I can get all the decimals?
Thanks,
Thomas
You are seeing 37.787358900000001 instead of 37.7873589 because of the nature of representing floating point numbers in a computer.
That said, it is pointless to worry about decimal places beyond the 6th position because even changing the 9 to an 8 would result in a change of about 1 centimeter. The GPS system is currently accurate to about +/- 5 meters, and with new chips being deployed by Broadcom that can be reduced to about +/- 30 centimeters in the near future.
By the way, do you know why the altitude keeps updating/changing, even
when the device is standing still on a table?
Altitude calculations are done by computing the distance to the visible GPS satellites which orbit the Earth every 12 hours. Since the satellites are constantly moving, and different satellites come into view, these calculations do tend to fluctuate. This article though a bit dated is enlightening.

cllocation -distanceFromLocation bad accuracy

i am developing an app which is particularly dependent upon the distance between two iOS devices. I am using GPS location of devices to calculate the distance between them.
To calculate distance, i am using cllocation -distanceFromLocation method but the values generated by method is fluctuating and differs from actual distance between devices and cannot be considered even as an approximate result.
For example, if the actual distance between devices is 2 to 3 meters, it gives me the result around 14 meters at some point and 43 meters at another point. Is the the function -distanceFromLocation: is not so precise and accurate????
Is there any better alternative for calculating distance using GPS latitude and longitude of devices???
Please help me out.
Thanx in advance.
The accuracy of CoreLocation GPS varies greatly depending on your surroundings.
At it's most accurate it can go down to a couple of metres resolution (I'm not sure exactly) but if you're indoors it will be more like 20-50 metres.
I'm guessing that you're developing and testing the app indoors and so the fluctuations would be about normal.
Even outdoors in perfect weather CoreLocation will struggle to accurately tell you the distance between two devices over a short distance. (i.e. a couple metres).
For short range you might be better using wifi signal strength instead. Although this can also change from room to room.
Essentially, it's difficult to accurately detect the distance between two devices.

How can i handle distance through accelerometer?

My object starts from zero. When the time goes..It covers some distance, so how can I measure this?
Oh, it's simple. All you have to do is implement an Inertial Measurement Unit and then an Inertial Navigation System. It's going to be hard to do without rotation sensors, it would probably require a Kalman Filter for accuracy, and typically it is done with ring laser gyros or fiber optic gyros, which are "solid state" devices that work by measuring relativistic effects and sell for rather higher prices than the silicon micromachined sensors in the iPhone, but you might get it to work.
Or, you could just use the GPS.
Other than just being alerted that the device did move, the accelerometer will not be much use. You will not get a reading of "device moved 10cm" or something similar, as far as I know you'll just get a value for how much acceleration occurred.
If you need to track your device's movement in the physical world you'll need to use the Location APIs.
You can figure this out, but it won't be that accurate, mainly due to sample rate and the inaccuracy of the accelerometer.
First figure out direction and force of the movement. If the user moves the iphone at +0.1G along the X axis and 0G along the Y and Z axis, then our force is +0.1G on the X axis. 1G is 9.8m/s, so the phone has move 0.9m if it has been traveling for 1 second.

GPS coordinates on mobile phones

Can GPS on a phone, such as iPhone or Android determine your Z coordinates ?
I know it certainly has to be able to determine X and Y, well longitude, latitude that is, but what about the Z coordinates ? Can it determine your height, and can I obtain height relative to ground ?
Height, as measured by a gps, is relative to the WGS84 ellipsoid. The WGS84 is representative of the field where the gravity is the same, the geoid. Not quite the same as the ground.
You can determine altitude with iPhone using CoreLocation
http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocation_Class/CLLocation/CLLocation.html
Android surely can ... have a look at the features of e.g. MyTracks which include even evaluation profiles.
Altitude, however, is usually measured in "above sealevel", which means, that you could determine the distance from the ground by substracting the ground evaluation from your actual evaluation: ev(ground) - alt = distance(fromGround).

How accurate is the reading for GPS in iPhone's SDK?

Using iPhone's SDK GPS API, how accurate can I get? Is it within a few meters or kilometers? I'm interested in the accuracy when it is indoor. My software will only be used in door.
The best possible accuracy seems to be 9 meters. Common values (outdoor, good coverage) is 17 m, 23 m and 49 meters. With trees covering the sky you'll probably stay under a hundred meters, but hardly accurate enough for GIS or anything like that.
The API has a property or method that returns the current accuracy of the location measurement. If your goal is only to use the location if accuracy is within some limit then you should make sure that you check the returned accuracy, since the location may be only accurate to within a few thousand meters initially as its just using your location from the cell towers, and it will typically get better and better accuracy as the GPS powers up and starts getting a fix.
Most standard GPS chips (and the iphone is that) can get around 10 meters accuracy.
Best results are outside on a clear sky obviously.
The difference between GPS chips is usually how quickly they can reception and how well they can hold it. Accuracy is pretty constant except for those using WAAS sattelite (which the iphone GPS doesn't do)
Based on my own experience it's within meters.