# How to get earth GPS angles coordinates from screen point after rotation?

Hello,

My project is geographic.
Current problem is to get GPS angular coordinates of a point under the cursor.
I use an Orthographic camera.
I can achieve GPS calculation using trigonometry, when there is no rotation.
Here the earth is shown without rotation, with zoom back, and the cursor is over the top north place of south america, It computes correct GPS coordinates (in white) which are approx 11° latitude, -73° longitude. Same for any place and any zoom level.

Now let’s say we rotate earth (rather than camera which stays fix at 0 0 -1000) in order to have France at the center of the screen : rotation works fine, having GPS of France (46 north, 3 east) :

The problem now is : how to get GPS coordinates now. I was not able to achieve this using trigonometry, have you a clue for this ? (image below shows what I would like to get: New York at -73, 40, not at -47,66 !:

Hi all,

I resolved the issue using raycaster. Globally speaking :

1. rotation of earth (not of the camera for some reasons) works fine (custom script, not OrbitControls, for other some reasons)
2. when picking a point, using raycaster to get its absolute coordonates (ie from camera to point)
3. have the point reverse-rotate using :

point.applyAxisAngle(vectorX, -earth.rotation.x);
point.applyAxisAngle(vectorY, -eeart.rotation.y);

1. calculate a bit the point’s local coordinates (GPS gx gy + world x,y) the following way

let latpole = point.angleTo(vectorY);
gy = (Math.PI/2 - latpole);
y = PM * gy / 2 / Math.PI ;
gx = point.z > 0 ? Math.asin (point.x / ( R * Math.sin(latpole)) )
: point.x > 0 ?
Math.PI/2 + Math.acos (point.x / ( R * Math.sin(latpole)) )
: - Math.PI/2 - (Math.PI - Math.acos (point.x / ( R * Math.sin(latpole) ) ) ) ;
//debug(‘lon:’+180 * gx / Math.PI );
x = PM * Math.cos (gy) * gx / 2 / Math.PI ;
}
return [gx,gy,x,y];

And this is absolutely correct, provided earth’s geometry is made of about 1000 x 1000 vertices (the raycast precision is correct)

Best regards.

PS : Sorry if a missed a notification, I did not get it in my email until today.