# Braun/Gall projection and pixel conversion

I am fairly new to projection mathematics and I usually manage to get things to work with copy-paste and trial-and-error but this time I'm lost ...

I am trying to map latitude (-90 to 90) and longitude (-180 to 180) coordinates onto pixel satellite images from Mappy, which uses a tiling system much the same as Google or Bing (more info). Unlike Google, Mappy doesn't seem to use Mercator projection but Gall or Braun (I found out by pasting a Gall map on top and saw that it matched). To be precise, they actually put a rectangular Gall/Braun projection of the earth and add a white strip on top to get a square (necessary for the tiling). So I have a Braun map of the earth (let's forget about the white strip) and I want to know which pixel are the coordinates 0.0, 0.0 (Gulf of Guinea), for example. Where should I start ?

This is how I proceeded so far:

From Wikipedia I got that Braun projection works as follows, with R radius, λ longitude, φ latitude

• x = R.λ
• y = 2.R.tan(φ/2)

I was previously working on a Mercator map (directly with the final equations lat-lon to pixel, as found here) and surprisingly the horizontal transformation from longitude to x-pixel was working perfectly with Braun as well. It appeared to be the inverse equation (plus the Greenwich offset) of the one presented on Wikipedia `x = (λ+offset) / R` instead of `x = R * λ` (as if was looking for λ and not x).

And so I tried to invert the vertical equation as well and finally got (with the parameters radius, offset and image size):

• x = (λ+180 / 360) * width of image
• y = 2*atan(φ+90 / 2*180) * height of image

Note: I used a horizontal radius from -180 to 180 = 360. Vertically, -90 to 90 = 180

This all sounds very illogical but the weirdest thing is that experimentally I get very nice results in x and not crazy ones in y. Actually quite near sometimes. I guess it's only by chance ...

• Without looking too closely it loks like 2*180 in the lat calculation should be 2*360 to match R in the long calculation – Ian Turton Oct 27 '14 at 11:54
• Your formulas are incorrect (according to standard conventions concerning order of operations and assuming "." refers to multiplication): "2.atan(lat/2.R)" will be interpreted as "2*atan((lat/2)*R)" instead of "2*atan(lat/(2*R))" as intended. Could this perhaps be the source of the problem? Or did you insert the proper parentheses in your calculations? If you used parentheses correctly, then the next thing to look at is your use of `atan`, which is easy to invoke incorrectly. Why not post exactly the expressions you have been using to attempt these calculations? – whuber Oct 27 '14 at 17:09
• Thank you for your comments, I just edited the question ! – crtn-hrd Oct 27 '14 at 18:46
• Concerning the formulas for `py`, adding 90 degrees to the latitude should not work. – whuber Oct 27 '14 at 21:13
• You have four pairs of equations. The first pair represent the map projection from (λ,φ) to (x,y), or geographic to map coords. You lost me from this sentence "To find the pixels from the latitude and longitude it thought it should be like that, the opposite equations:" onward! Can you re-write that sentence for clarity? I don't understand what the second pair of equations is supposed to represent. – Martin F Oct 28 '14 at 3:05