If you don't want to do the calculation yourself, you can use an online calculator like the one provided by NOAA.
Alternatively, if you do want to do the calculation yourself you can use the haversine formula.
This uses the ‘haversine’ formula to calculate the great-circle distance between two points – that is, the shortest distance over the earth’s ...
45E is directly opposite 135W.
It's therefore obvious (hopefully) that the shortest path is straight over the North pole (which is at 90 degrees North). The path takes us round 120 degrees of the Earth's circumference, or 1/3rd of it.
The database with the negative longitude angles is storing longitude as eastings and westings, whereas the other database is storing everything as eastings.
It appears you prefer your data as eastings and westings. Your methodology for changing eastings greater than 180 degrees to westings is correct: where the longitude angle is greater than 180 subtract ...
Apparent dip is the name of any dip measured in a vertical plane that is not perpendicular to the strike line. True dip can be calculated from apparent dip using trigonometry if you know the strike. Geologic cross sections use apparent dip when they are drawn at some angle not perpendicular to strike.
In Matlab if you have the mapping toolbox you can simply do:
And your approach is totally right, but if you have to do it more often or with other dataset with diferent conventions you can set up functions analogous to those in the maping toolbox. Such as:
function lon = wrapTo180(lon)
q = (lon < -180) | (180 < lon);
I think you should read the book by Dava Sobell. It will give you perspective and lead you to original source materials. See:https://www.amazon.com/Longitude-Genius-Greatest-Scientific-Problem/dp/080271529X