-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
The conversion from degrees to pixels is working just fine, but if i try to convert the pixels back to degrees again it is off
example:
lat = 36.1
lng = -5.4
degtopx ->
x = (lon + 180) * (mapW / 360);
y = (mapH /2)-(mapH *Mathf.Log(Mathf.Tan((Mathf.PI/4)+((lat Mathf.PI/180)/2)))/(2Mathf.PI));
(mapH & mapW are both 2048)
results in (993.56, 803.25)
and this back to degrees
pxtodeg ->
lat = (x - (mapW / 2)) / (mapW / 360);
lng = (Mathf.Exp(-(y-(mapH /2)) /mapH (2Mathf.PI))- Mathf.Tan((Mathf.PI/4))*2)/(Mathf.PI/180);
results in (-1.8, -5.4)
so the latitude is way off?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels