-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
The function convert_to_latlon gives wrong longitude values that can be above 180 or below -180 degrees when the reference longitude is close to +/-180. This should fix it:
def convert_to_latlon(y, x, latitude, longitude): pi = 3.14159265359 r_earth = 6371000 lat_diff = (y / r_earth) * (180 / pi) lon_diff = (x / r_earth) * (180 / pi) / math.cos(latitude * pi/180) final_lat = latitude+lat_diff final_lon = longitude+lon_diff final_lon = final_lon - 360 if final_lon > 180 else final_lon final_lon = 360 + final_lon if final_lon < -180 else final_lon return (final_lat, final_lon)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels