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 ...