I'm currently using an OSM dataset of San Francisco and I want to calculate the angle of elevation of each road segment using x and y coordinates given by this dataset. I used this formula and I get wrong data. the formula:
dLon = (long2 - long1);
y = Math.sin(dLon) * Math.cos(lat2);
x = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1)
* Math.cos(lat2) * Math.cos(dLon);
angle = Math.atan2(y, x);
angle_degree = Math.toDegrees(angle);
rt = (angle_degree + 360) % 360;
ang = 360 - rt;
Ps: I converted longitude and altitude coordinates to radians to use this formula.
Have you any other suggestions please?