# Mercator projection - Use existing equation to solve for degrees

Mercator projection: problem with latitude formula

The answer to the previous question explains how to determine the correct pixel position at a given degree on a Mercator map. For example plug in a given map width in pixels and a given latitude in degrees and it will spit out the correct pixel position. I've tested it with dozens of possible degrees and it always comes back with the right answer. It's awesome.

This is the equation. The 2 variables are mapWidth ($w$) and degreePosition ($d$) and the output is pixelPosition ($p$).

$$p=\frac w{2\pi}\ln\tan\left(\frac\pi4+\frac d2\cdot\frac\pi{180}\right)$$

However I need to solve this equation for degreePosition and my brain has reached the breaking point. After multiple attempts I can not figure out what to do. degreePosition is buried inside a natural log and tangent and I can't figure out how to get it out to one side.

Thanks so much for any help!