# Theory - The Flat Earth Problem

## What was the Flat Earth problem?

Simply put, X-Plane, up through version 6.04, models the earth as a flat surface rather than as a sphere (OK, oblate spheroid for you nitpickers).

The most obvious problem with the flat earth model is that long distance navigation, such as great circle routes, don't work right. Similarly, headings given by the GPS to faraway locations tend to be bogus. However, there are some subtle effects at the local level that can trip you up.

All of X-Plane's interactions with objects (buildings, runways, navaids, etc.) are based on their placement on a 3 by 2 degree rectangle, which is what you see in the "Low Enroute" window. X-Plane builds the Low Enroute window around you when you place the aircraft, and then as you travel, adds whole degrees in front of you and drops whole degrees behind you to keep you more or less centered in the window.

One of the problems with this design is that you may not always be able to pick up navaids when you should be able to. For example, if you're flying north, X-Plane will load the next row of degree squares when you're halfway up the northern row. That's about 30 miles from the edge. That means if there's a VOR just over the line in the next degree square, you won't see it until you're within 30 miles and X-Plane loads that square. That's not consistent with the 100+ mile range of many VORs. The menu of approach plates for airports also keys off what's visible in the Low Enroute window, so you can't bring up the approach plate for an airport in many cases until you're way beyond where an airliner should be starting its descent.

Viewed from directly above, any square degree on the Earth's surface (other than at the equator) is slightly trapezoidal. That is, in the northern hemisphere the northern edge of the "square" is slightly smaller than the southern edge. At mid latitudes like Boston, the difference works out to be about 4300 feet, and the two sides of the trapezoid are about .67 degree off parallel.

Because each square degree is a trapezoid, they are laid into the Low Enroute window roughly as follows:

-------      -------      -------
|      \     |      \     |      \
|       \    |       \    |       \
|        \   |       *\   |        \
----------   ----------   ----------
|         \  |         \  |         \
|          \ |          \ |          \
|           \|           \|           \
---------------------------------------

This design makes the distances within a square degree correct but leaves gaps between the squares. The trapezoid mapped onto the flat earth causes subtle errors in navaid placement. Objects located near the right edge of a trapezoid are effectively displaced to the west, depending on how far north in the trapezoid they are. As an example, consider the ILS marker for a runway 36 located a mile north of the runway center. If the runway is located at the right edge of the trapezoid, for mid-latitudes the skew of the edge will put the ILS marker about 70 feet to the west of the runway. However, the runway is still drawn vertically relative to the overall grid, so in effect the ILS is now 70 feet off the runway centerline.

The navaid data Robin Peel creates for X-Plane corrects for this error by rotating runway and ILS headings slightly (counter-clockwise in the northern hemisphere and clockwise in the southern hemisphere) to make the runways and ILS line up.

As you cross from one degree square to another, you'll see the gaps in the form of stretched out terrain with no landmarks in it. And if you're tracking distance carefully, you'll might find that landmarks are a little too far apart.

But... there can be a *big* problem with navaids at certain airports. If you place yourself at KBOS, you'll be at the * in the picture. Notice the big gap immediately to the east of KBOS. The runways at KBOS all have centers slightly west of 71W. However, all the navaids on the east ends of the runways are east of 71W, and so are on the other side of the gap. At 42.38N latitude, the gap is about a mile wide. Because the ILS and GS are at opposite ends of the runway, almost every runway has one of its navaids screwed up. Either the ILS puts you a mile off track, or the GS puts you into the weeds. Only runway 33 has both ends west of 71, and so has usable navaids.

There are about a half dozen airports in the world that straddle a meridian, and all have this kind of problem with their navaids. Boston is the most well-known and obvious. Now there's another problem with the flat earth projection that affects airports that straddle a degree of latitude. Consider what happens to the above picture when you fly south. As you cross into the southern half degree, X-Plane drops the northern row of square degrees and builds the next row south. The row you're in does not get rebuilt, so the Low Enroute window now looks like this:

-------   -------   -------
|      \  |      \  |      \
|       \ |       \ |       \
|        \|        \|        \
------------------------------------
|         \  |         \  |         \
|          \ |          \ |          \
|           \|           \|           \
---------------------------------------

You can see this effect at Chicago O'Hare (KORD). When you initially place yourself at KORD and check X-Plane's approach plate, everything is fine. Now place yourself about 100 miles north (say, halfway up the shore of Lake Michigan) and then fly south to KORD. When you're in range, bring up the plate for KORD again. You'll see that the ILS for runway 32R is now about 4300 feet off to the west. That's because the ILS for 32R is slightly north of 42 degrees, while all the rest of the airport is just south.

## How Has the Flat Earth Problem Been Solved?

X-Plane's flight simulation continues to operate in a local 3x2 degree coordinate system very much like in the old flat earth model. However, as of version 6.05 it uses a proper 3 dimensional projection of that portion of the round world into the local space. If you look carefully at a sectional chart, you can see a slight trapezoidal shape and curvature of the top and bottom edges, caused by the curvature of the earth. The 3D map view also shows the curved earth's surface.

The reason for maintaining a local coordinate system is that OpenGL operates in single precision. The resolution of single precision, when magnitudes like the earth's radius are involved, is not good enough. (It's a couple of meters, which would cause terrible jitter in the display.)

The correct 3 dimensional projection fixes

• the terrain distortion
• the terrain gaps
• the runway / ILS misalignments

X-Plane still does terrain loads once per degree, as it always has. On each terrain load, the local coordinate system is remapped to keep it aligned with the view in the Low Enroute window. One of the side effects of the remapping is that the old problem of the terrain jittering after a long flight is also solved.

X-Plane models the earth as a sphere, not as the slightly lumpy ellipsoid it really is. (The earth is ellipsoidal by about 1/3%.) As a result, there are very slight discrepancies in distances and relative positions vs geographical coordinates. These discrepancies are very minor, and normally only matter when you're trying to place objects very precisely over larger distances, such as runways and taxiways. They are also typically overshadowed by other simplifying assumptions made by X-Plane when it renders runways and other large objects.

There were a few rough edges in this model that were not sorted out completely until 7.41:

• The plane experiences a slight "bump" at each terrain load. The reason for this is that because of the earth's curvature, when the local coordinate space is remapped, it needs to be rotated slightly. The plane's velocity vector is rotated accordingly, but its attitude is not. As a result, the plane's attitude is momentarily inconsistent with its flight path.
• GPS and VOR readings change suddenly at each terrain load, due to frame of reference bugs in the bearing computations. As result, for example, if you're flying a VOR radial on autopilot, the plane will make a sudden course correction after a terrain load.

In 7.41 and later these problems are solved. The only minor anomaly left now is that the haze layer of the lower atmosphere makes a small visual jump at each terrain load.

Back to the Theory page