iOS CLLocation Altitude Field - Ellipsoidal or Geoidal? - ios

I was wondering if anyone would be able to provide insight into whether or not the altitude returned by the CLLocation object is an Ellipsoidal height or a Geoidal height?
I know over in the Android world that the Location class has a member 'Altitude' which is defined as being 'meters above the WGS 84 reference ellipsoid'. This makes the value returned an Ellipsoidal Altitude and the results of a lot of testing seem to back this up.
However, the documentation for the CLLocation class does not make it clear what the altitude member in that class refers to (geoidal or ellipsoidal). A lot of testing has led me to believe that the alittudes are in fact geoidal heights but there is no documentation about whether this is true or not and if it is true, what geoid the heights are based off of (EGM96, Geoid 12B, Geoid 18, etc...). For my application's purpose I need to be able to get altitudes returned from CLLocation objects to be ellipsoidal heights (i.e. add the geoidal undulation calculated from whatever geoid model iOS is using) so that I can then apply a correction from a different geoid that a user has selected.
If anyone has any insight into this topic I would greatly appreciate it!

From altitude documentation,
Discussion
Positive values indicate altitudes above sea level. Negative values indicate altitudes below sea level.
https://developer.apple.com/documentation/corelocation/cllocation/1423820-altitude#declarations
and since geoid is a model of global mean sea level we can infer that returned heights are above the geoid, or orthometric.
https://en.m.wikipedia.org/wiki/Orthometric_height
I couldn't find any reference about the geoid model used in IOS.

Related

CoreLocation location with incorrect floor and level property

I would like to expose an issue I’m experiencing while using the Indoor Maps Program.
I have already fingerprinted floor 0 and 2 of a venue with Apple’s Survey app and indoor locations are already live.
I have also been able to receive location updates from CoreLocation API, floor (CLFloor) object within location (CLLocation) is not nil and is returning floor level values. This is good.
However, when I am first transitioning from one level to another (say 2 -> 0), I do get a few locations back with floor equal to -1, which I believe is wrong and should be nil instead, if anything.
Also, I have noticed that this is also happening if requesting for location updates for the first time, on any app that requests location updates with CoreLocation, indoor maps program aside. I have noticed how floor object (CLFloor) within location (CLLocation) is not nil, and level is equal to -1 on the first few locations that come back.
According to Apple’s Documentation:
Level values represent logical levels above or below ground level and
are not intended to correspond to any numbering scheme in use by the
building itself. The ground floor of a building is always represented
by the value 0. Floors above the ground floor are represented by
positive integers, so a value of 1 represents the floor above ground
level, a value of 2 represents two floors above ground level, and so
on. Floors below the ground floor are represented by corresponding
negative integers, with a value of -1 representing the floor
immediately below ground level and so on. It is erroneous to use the
user’s level in a building as an estimate of altitude.
CLLocation
var floor: CLFloor? { get }
var level: Int { get }
Has someone experienced anything similar?
Is this a bug from Apple or is this to be interpreted somehow?

How to evaluate the remoteness of a location given its coordinates?

I need to be able to evaluate how remote a location is given its geographical coordinates. I rate remoteness based off of a few key metrics, so far, I am only able to calculate a subset of all the required metrics:
The cellular reception at the given coordinate. More specifically, the density of cell towers around the coordinate. This can be found using opencellid.org.
Elevation. This can be found using Google's Elevation API
How can one find these remaining metrics for remoteness?
The type of natural feature the coordinate is in. (eg. Lake, River, Glacier, Ocean, Island, Mountain)
Distance to the nearest road. (Google's Snap Road API and Nearest Road API only work if the coordinate is within 50m of a road, that will not work as some coordinates are hundreds of km from the nearest road).
About land type
For your first question it has already been answered here, except it is only for land/water.
My approach would be the following:
Using maps static, you get the image at your coordinate, you get the pixel at the center of your image (your coordinates) and you use a hashmap/dictionary that contains all the different possible colors and their land type, would be very quick to implement. But you can find out different ideas by reading the first link provided.
For strength of cellular signal
As for your second question, you can use Google API to detect the closest cell towers object, using the locationAreaCode that you can obtain through the coordinates:
An example cell tower object is below.
{
"cellTowers": [
{
"cellId": 170402199,
"locationAreaCode": 35632,
"mobileCountryCode": 310,
"mobileNetworkCode": 410,
"age": 0,
"signalStrength": -60,
"timingAdvance": 15
}
]
}
What is the purpose I wonder? You could take a sampling of coordinates around the fix and if they are mostly on a hill or in water it is definitive, it seems people know how to figure out this kind of stuff with google apis.
Would this be good enough?
Get Lat/Lon and range from a sources like this: https://my.opencellid.org/dashboard/login?ref=opencellid for free. Use a formula to determine the distance between the gps locations like this: https://nathanrooy.github.io/posts/2016-09-07/haversine-with-python/. Then make your own determination on strength based on "range" and terrain. perhaps create a DB table of say 500 zip codes with label for terrain type rating. If 10 or something it's the worst terrain and you drop the strength by something that makes sense.

iOS location of PHAsset: accuracy is always 0

I'm trying to extract location information from the user's Photo library using PhotoKit. Trouble is, all CLLocation objects have a horizontalAccuracy of 0...
Wether it is PHAssetCollection.approximateLocation.horizontalAccuracy or PHAsset.location.horizontalAccuracy doesn't make a difference.
This information is important in my use case, and I know for a fact that in certain circumstances accuracy can be absolutely dreadful( error radius of more than 500 metres ).
Any insights appreciated!

Altitude Disappears from MKPlacemark

So I have some code that gets the user's location from the phone as a CLLocation, then I do a reverse geocode on it. The problem is that the resulting MKPlacemark has 0 for altitude, despite the fact that the CLLocation had a value in the altitude field.
It makes sense that if I just ask for the address of some coordinates, I don't necessarily get altitude (as that would require topographic logic). Most of the questions on here suggest calling out to a topo service.
I am wondering why the reverse geocoder would not just preserve the altitude, and also asking people what their preferred solution has been to this problem. It's not like it's hard to figure out: I can pass the altitude in separately and then just jam it into my ultimate object (my own address class), but that's ugly.
This is indeed the state of these classes at this time. Probably a bug report with Apple is in order.

Can longitude and latitude change?

I'm working on a GeoTargeting application. I'm curious if longitude and latitude of a point on the earth can change?
If you know the exact position of the statue of liberty how sure is it that longitude and latitude will stay the same.
Does it change according to the season, time in the year, or slowly over time
Wikipedia to the rescue:
The surface layer of the Earth, the
lithosphere, is broken up into several
tectonic plates. Each plate moves in a
different direction, at speeds of
about 50 to 100 mm per year. As a
result, for example, the longitudinal
difference between a point on the
equator in Uganda (on the African
Plate) and a point on the equator in
Ecuador (on the South American Plate)
is increasing by about 0.0014
arcseconds per year.
It depends on the map projection variables you use. Currently WGS-84 is used mostly.
The same point can have different coordinates depending on the variables. They do not differ a lot, I remember the difference between EUR-50 (or something like that) and WGS-84 was at most 50 meters or something.
You're tangentially referring to geodetics, which is the science of modelling (representing) the shape of the earth. So while a physical location may not change, the datum (model) used by a geodetic coordinate system will change, fortunately this does not happen frequently.
In North America NAD83 is the mostly widely used datum, which replaced NAD27.
Did I mention that Geographic Information Systems (GIS) was my foray into software development?
Yes. Zip codes get split all the time, and doing so would move the center of the zip code to a new location.
47.554 always equals 47.554
But if the shape of the earth changes or you are using different methods of calculations (there are plenty) or if the input data changes in precision or if if your compiler treats floating point differently..
you'll end up in different long/lat

Resources