One long-term project I’ve worked on involves loading map data from Open Street Maps into my c++ OpenGL driving game.

The exported data is in rather large XML, and requires a bit of pre-processing into nodes and road segments. The longitude and latitude need to be converted to x and y coordinates, which I solved by ‘spinning the earth’ so that the area of interest is in the north pole, and then flattening it.

Here are some pictures

I added code to properly curve sharp corners

and I even made a test program to work out the algorithm

Leave a comment

Your email address will not be published. Required fields are marked *