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

Ben is a software engineer who works on X-Plane; he spends most of his days drinking coffee and swearing at the computer -- sometimes at the same time.

1. James says:

I’d assume that another benefit of starting with bezier paths is that you might very well end up with better looking tracks… even though the finished product is still raster data. The OSM data seems to be a sequence of dots connected by straight lines – not smooth.

Is that assumption correct?

1. Yeah – for users who can afford to crank settings, we can always subdivide the beziers into a larger number of small segments (since the graphics card is going to need lines and not curves in the end). So this gives us scalability and the ability to make a really nice looking high-end visualization. We’re already pulling the same trick with airports.

2. Nelson says:

Do you use something like Douglas–Peucker first (to simplify the points) and then convert them to Bézier?

1. The simplification is more complex than DP because we have to keep the roads topologically correct – that is, we can’t simplify such that two non-crossing roads simplify into an intersection. The algorithm we use comes from a paper whose title I can’t recall, but I think it’s cited in the scenery tools source. (Of course, the source is there too if you want to read it.) We use a Delauney triangulation – I think I might have blogged it.

//hacksoflife.blogspot.com/2011/05/mesh-simplification-part-iii.html

3. David Troyer says:

So can we still expect to receive the latest OSM with each release? It seems less likely with conversion plans.

1. Hi David,

Sorry to beat you over the head with this but I really have to be absolutely clear on this.

No. You cannot expect to receive the latest OSM with each release. You cannot expect any updates to the global scenery.

LR has _never_ at any point indicated publicly that we will update the global scenery post ship.

We _may_ decide to do that at some point; many people have asked for it and it would be nice.

But I need to make clear that we are _not_ advertising scenery updates with the sim.

The reason I have to bash on this is simple: I don’t want anyone to buy X-Plane and then come to us and go “I payed XXX, and you promised me free updates to the global scenery.” We have made no such promise. Maybe in the future, but we have not yet signed up for this.

cheers
Ben

4. Could you Ben update the OSM data directly, I am using Osm2XP (but not to successfully as it kills other scenery around it), or is the OSM data burnt directly into the tiles, which is good in it can’t be ruined accidently or bad if it is not updated for 3 or more years

1. Well, theoretically anyone could create new tiles – the code to create the tiles is open source, and pretty much all of the data is publicly available. We may be able to help in some way. But the road data you get from us undergoes a fairly different process than Osm2XP. We’ll find some way to cope with OSM – but I can’t map out that entire process now.