Real world map to game terrain (osm2terrn2 Project)

Joako360

Mechatronics Engineer
Recently I discovered an open data map, OpenStreetMap, which allows you to export data from an area, and it is possible to develop a solution to convert data from this map into a game terrain.The objective of this would be to make more realistic terrains in a simpler way, mainly oriented to urban environments.
But this would significantly reduce the creative-artistic factor of creating a totally fictitious and non-existent environment, as had been done since the beginning of time.
My question would not be if it can be because I could do it, my question would be if it is "morally" right to do it.
That's why I created this thread, to make sure I was not creating a "monster" land generator and flooding the repository with real-life maps.
Well... that's it... thanks for reading and waiting for soon response ;)
 
Hello @Jonako360 and thanks for posting the interesting question.

This is the first time I'm hearing about OSM, so I did some googling on what data it contains and if anyone ever made a meaningfully looking game terrain with it. Turns out that there's a very good looking actual case here: Osm2city.py - FlightGear wiki

I think it would be great to have a tutorial or a tool for converting OSM data to RoR terrains. I see it as a fresh new approach to play RoR. The point about repository deserves a larger discussion, it would most likely need a new category or something, but I think this is also fine.

You're saying you can do this already... I'm curious to hear more about your tools and techniques.
 
Hello [MENTION=356]only_a_ptr[/MENTION] and thanks for the quick response.


Well ... then a tool that creates real world environments is fine, that's good news, so I'll start this project. Thanks for finding Osm2city.py, it is an important help.


About the tools and techniques that I use, I must confess that I am not a systems expert, just a engineering student. I was learning to develop Windows console applications in C/C++, so my main IDEs would be Visual Studio and Code::Blocks. I am learning to use GitHub as a project manager.


But my knowledge in programming is enough to start developing a WIN32 console application that converts OSM data to terrains with object definition and etc.


So, my idea would be to develop the project alone, when the project has an important advance and learn to manage projects on GitHub (it is more complicated than it seems at the beginning), I publish the code for those who want to bring changes to the project, etc.


I will announce any news by this same thread, be patient, thanks :).
 
Hello again, after some time since the last publication, I have to announce that the current status of this project is ... Active!:D but with some changes in the original concept. After some research:unsure:, I discovered and decided that C # is a good option for the realization of the idea, since it allows to work with xml files much easier and faster than C/C ++. This Project also has a name, I named it "osm2terrn2" (It'll generate all necesary files, not only *.terrn2, but i guess it's a good name :giggle:)

Then, I decided that it is better that the project can be programmed in Visual Studio as a Visual C # Windows Forms Application project (not a console application as planned), with this we will give a graphic interface, which will make it easier to use it.

I am organizing a repository on GitHub to host the project, I am still learning how to use it (I only program arduino microcontrollers and console applications, this is new for me hehe), if you want to take a look I leave the link: Osm2Terrn2 Repo. Its incomplete because I have only defined all filetypes classes, but there's no process yet (empty program LOL), but it's a beginning.

That's all, I will be trying to do updates more frequently, just trying! (nothing promised).
 
Update May 2021:
1- Sorry for the long absence.
2- Now talking about the project...
I said that the project would be based on C#... but that was before I learned a minimum of python (much easier for someone who is not a programmer like me who study mechanics), plus I found a library to use openstreetmap data (osmnx). So, I deleted the C# project repo and started another one in Python.
I have to add the documentation of how my idea works to agree on the direction of the project. Also, I am about to finish personal projects, so I will be working on it when I can.
in short:
Goodbye C#, Hello Python 3.8 (I particularly use anaconda suite and recommend to use it for those who are interested in participating in this project (more details in the documentation of the repo (when I have time I will write it))).
 
Also when this is done, will this auto-import buildings, roads, etc? That would be cool.
Including real life buildings is something I plan to do since it is not as difficult as it seems, just draw an outline, extrude it up a couple of meters, change the roof model and put some textures. But for now I'm trying to make sure the streets have the right elevation and orientation.
 
I wanted to show you where the version I have named "indev v0.1" is in.

I am doing the tests in my city, Luis Guillon, Argentina (more info here). This way I can tell that something is wrong.
Starting with the heightmap.

1622733784306.png


I want to show that it can build an elevation map. I find a couple of problems with this:
  • I do not have a real elevation map with which to compare if this result is correct or not. In this case of Guillon is a city with low elevation, and from my perspective it makes sense, although it is not the best example.
  • Resolution, I am working with a native resolution of 30 meters per pixel. This is improved by increasing the resolution and applying interpolation to the values.
  • Finally, something that perhaps is not so serious is a problem with the algorithm that builds this elevation map that repeats values in some places, if you zoom in on the image you can notice a cross-shaped pattern in the center.
In the future it is planned to add depressions for rivers and lakes or lagoons.

Here a screenshot of the result so far
screenshot_2021-06-03_12-11-34_1.png

As you can see, there are only the street crossings, without streets, that will be the next thing.

screenshot_2021-06-03_12-43-56_1.png

Here you can see that the elevation of the crossroads does not match with the elevation of the terrain, surely there is a precision error in the elevation map and that is something that must be corrected.

Future plans:
  • Add streets. I plan to use the procedural streets included in the game. once this is achieved, a beta test can be launched.
  • Add railroad networks.
  • use information from airports, train stations and racetracks.
 
This is awesome! When this is released, I also wanna make the town of my grandmother's house, and the other town is connected by a bridge.
 
cool! Is the UK will be implemented?
He never said he's making maps. He said he's making a tool that'll create real maps, So you'll have to make the map yourself. You'll have to make loads and loads of maps to do the whole of the UK though. be better to do just a small village or farm town
 
This is something I looked in to, but real scale maps get a bit boring, due to the time taken to get around.
I saw a lot of games use scaling, so one of the commercial truck sims scales towns and cities to 1/3 and motorways to 1/10. This then makes a lot of work for picking what streets to keep and drop etc.

Even games like Forza Horizon seem to be about 1/2 to 1/3 scale.

Your precision error might be down to the projection of the maps, OSM is WGS84 which is only accurate to between 2 and 5m in x and y. If you are using python though you can reproject using gdal
 
As an example of the difficulties I experienced: to make this bridge to 1:1 scale for a terrain derived from OSM it needed to be just over 1km long. Same size as some existing maps!
 

Attachments

  • Screenshot_20210827_141152.png
    Screenshot_20210827_141152.png
    451.6 KB · Views: 430

🔧 OSM2TERRN2 – Project Update and Call for Collaboration​

Hello everyone,

I’d like to take this opportunity to provide a new update on the current state of OSM2TERRN2 (now officially known as OSM2TERRN for the sake of clarity, although this may change in the future), and at the same time, open the project to collaboration.

🔗 Project Repository​

For those interested in exploring the codebase or contributing, you can find the project here:

👉 GitHub Repository - OSM2Terrn:
https://github.com/Joako360/osm2terrn

Since some time has passed since the last update, I wanted to include the link again to make access easier for both new and returning contributors.


🚀 Current Project Status​

During the past period, I have been mainly focused on the complete restructuring of the project, with the aim of making it more maintainable, scalable, and accessible for future contributors.

The most important changes are the following:

  • 🔄 Code structure changes
  • 🧹 Code cleanup and better separation of concerns
  • 📁 Standardized project structure
  • 📚 Basic documentation for developers
  • ⚙️ Preparation of the project for collaboration

🤖 Integration of Assisted Development Tools​

At the same time, I have been integrating new tools that can assist in the development process:
  • Integration of GitHub Copilot
  • Integration of ChatGPT / Codexfor:
    • Investigating possible solutions
    • Code refactoring
    • Rapid prototyping
These tools do not replace the development process but have been useful in accelerating the development process and investigating possible alternatives in an efficient way.


🧭 Project Objective (Reminder)​

The project’s objective is to generate terrains that are playable in Rigs of Rods, using real-world data provided by OpenStreetMap and other open data sources, such as:
  • Heightmap generation
  • Integration of road networks
  • Potential future additions:
    • Buildings
    • Infrastructure
      • Bridges
      • Railways
        etc.

📏 Considerations About Scale​

As for one of the issues raised in the above discussion, it is necessary to make the following clarification regarding the current approach to the map’s scale.

Of course, working with 1:1 scale maps might not be as exciting in some gameplay scenarios, especially when it comes to crossing long distances. This approach might be better suited for specific simulation gameplay scenarios, such as long-haul driving simulators.

However, at this stage of the project, the goal is to create small-scale urban environments, and the 1:1 scale approach might be better suited for creating an immersive experience by recreating familiar places such as neighborhoods or familiar areas of the environment, even with the more ‘fantasy-oriented’ vehicles that might be implemented in the project.

At the same time, this approach significantly simplifies the development process at this stage by avoiding the added complexity of working with geometric transformations and rescaling geospatial data.

Of course, in the future, when the project is further developed, the possibility of implementing adaptive scaling mechanisms according to the type of map or gameplay scenario is not excluded.


👥 Call for Contributors​

At this point in the project’s development, I believe it has reached the stage where it can benefit from the contributions of the community.

I am looking for contributors that are interested in joining the project and contributing to the development process. Specifically, I am interested in working with the following groups of people:
  • 🐍 Python developers
  • 🌍 Interest in geospatial data
  • 🧠 Willingness to experiment and contribute ideas
  • 🎮 Rigs of Rods enthusiasts (but this is not required)

🛠️ Areas for Contribution​

There are several areas that might benefit significantly from the contributions of interested individuals in the project’s development. Specifically:
  • Heightmap generation and improvement
  • Processing and simplification of OSM geometries
  • Procedural road generation
  • Terrain–infrastructure integration
  • Optimization and performance
  • Testing and validation
  • Documentation
  • Implementation of interactive command-line interfaces (CLI) and text-based menus

📌 Important Note​

This project is still in an early stage, which means that:
  • The architecture is subject to significant changes
  • Some components are still experimental
  • Both code contributions and feedback are highly appreciated

💬 Closing​

If you are interested in the project or would like to contribute, you are more than welcome.
Any kind of contribution is valuable, from code to suggestions or testing.

Thank you to everyone who has been following the project so far 🙌

— Joaquin, aka. Joako360
 
Last edited:
Great project !

I have just tried it and I had some issues I want to share:
- Downloading a city fails if the OpenTopography API key is not set in the OPENTOPO_ELEVATION_API_KEY environment variable.
- Export fails for me because the "output" directory doesn't exists. I was confused by the fact that main.py is not in the root directory but in "src" directory. So i changed to src directory and launch "python main.py". And it fails. It seems that the right thing to do is staying in the root directory and launch "python src/main.py".

I finally managed to get a map but it seems broken (see attached screenshot)
Anyway it's a great start.

I have made a similar project a while ago. If it can help in any way, here it is:

And some videos of maps created with it:

 

Attachments

  • screenshot_2026-03-30_17-48-23_1.png
    screenshot_2026-03-30_17-48-23_1.png
    1.7 MB · Views: 9
Great project !

I have just tried it and I had some issues I want to share:
- Downloading a city fails if the OpenTopography API key is not set in the OPENTOPO_ELEVATION_API_KEY environment variable.
- Export fails for me because the "output" directory doesn't exists. I was confused by the fact that main.py is not in the root directory but in "src" directory. So i changed to src directory and launch "python main.py". And it fails. It seems that the right thing to do is staying in the root directory and launch "python src/main.py".

I finally managed to get a map but it seems broken (see attached screenshot)
Anyway it's a great start.

I have made a similar project a while ago. If it can help in any way, here it is:

And some videos of maps created with it:


It is a very cool project, as a test I tried making a large portion of Pittsburgh, but Rigs of Rods crashes when I try to load.
 
Back
Top