Solved

# Geometrical algorithm

Posted on 2002-03-20

Can anyone provide me with an example of an algorithm to do the following conversion:

Input:

Latitude / longitude coordinate on earth's surface

Zoom level (from full world to a few miles across)

X/Y pixel width of PC screen

Asusming this lat/lon point on earth is being viewed form a point in space perfectly Normal to the earth's suface:

Output:

The X/Y point on the screen that the given input Lat/lon point maps to, given the above input data for zoom level and screen resolution.

I would also need a way to detremine if the lat/lon point is on the visible or hidden half of the earth (this is easy), and if hidden, figure out the last visible x/y point on the path from the previous visible point to the hidden point (more difficult).

Basically looking to map the spherical coordinates to rectangular coordinates.

Jeff