android - XYZ to LLA returns latitude in range -180 - 180 instead of -90 - 90 -
i'm working on 3d globe country picking. represented sphere radius equals 1. when user tap screen i'm getting point using ray object picking technique , i'm trying conwert lat, long nex way:
double alt = 1; double lat = math.todegrees(math.atan2(y, x)); double lon = math.todegrees(math.acos(z/alt));
this code returns latitude in range -180 - 180 degrees google geocoder says should in range -90 - 90 degrees.
how can fix ?
use atan2
longitude , asin
latitude.
double alt = math.sqrt(x*x+y*y+z*z); double lon = math.todegrees(math.atan2(y, x)); double lat = math.todegrees(math.asin(z/alt));
Comments
Post a Comment