This post is going to be geeky, and probably only of interest to X-Plane authors who have worked with OpenStreetMap data.
OpenStreetMap represents roads as a series of points…a lot of points. One of the problems with importing OSM into X-Plane is that the data density goes well beyond what X-Plane was designed to handle. I have seen OSM roads with a point every 8 meters!
Even if X-Plane could handle that data density, how do we fit all of OSM onto a few DVDs? The answer: convert the list of points to bezier curves.
This is the raw OSM line data for the interchange of I-8 and I-5 in San Diego. Actually, that’s a bit of a lie; the data has been reduced significantly in density. We reduce the data up front to avoid killing our DSF generation software, but also because the curve-generating process doesn’t need all of that data to do a good job.
This is the result of curve generation. The DSF generator tries to fit the minimum number of curves possible to the points by first converting line segments to approximate curves, then replacing pairs of curves with larger single curves up to a certain error point.
The error tolerance varies by road type: exit ramps are given a lot of leeway because they look good as long as they are loops; city streets are kept precise so that the curves don’t crash into buildings. Most precise: railroad tracks, where pairs of tracks are often very close together.
In this diagram, the blue and purple lines are the original curves and the white ones are the simplified replacement, showing error; the points are the actual data written to the DSF. Look at how few points we need for those on-ramps! At current settings, the algorithm reduces the size of road data in San Diego by about 25%.