Cities: Skylines

Cities: Skylines

OpenStreetMap Import - generate roads from OSM with street names and road-type selection
Alexander Jan 14, 2020 @ 2:19am
Nodes as main problem - OSM Data is perfect for CS BUT ...yeah BUT. Fix OSM Data. A community Solution!
First: Thanks for this OSM Mod. It works! But,, yeah there is a but. We all see the problem that CS sometime connects crossings, junctions perfectly and sometimes not. So I asked myself: Why? What is going on?

So I closely compared the imported Streets with Openstreetmap.org. (If you click on "Change" and then scroll very close you can see every streetconfigurations and nodes.) This is actually the Map.osm Data Info.

This is what I figured out: Let´s take the crossing "Goethestrasse" / "Dinghoferstrasse" in "Linz/Austria". Every street stops in the middle of the crossing at the Node. So there are actually 4 Streets. And the Node is the connection point between the 4 streets. Looking at CS it perfectly makes a crossing.

So...now let´s look at "Schillerstrasse" / "Starhembergstrasse". Schillerstrasse is passing right through the crossing. And so does "Starhembergstrasse". BUT there is a Node (!) in the middle, so Openstreetmap.org can recognize this crossing as a crossing.

But it´s actually a "fake" crossing!

This Node is like a glue which sticks the two streets together. And the Data says: "There are two streets, yes, but they are just passing by, like an overpass." And this is what you see at CS. Two streets just crossing without connection + sometimes a "Ghost Node" or a "strange Node" even sometimes "no Nodes".

Same with a T junction. If 3 streets have a Node as connection = Perfect, 2 streets (1 street passing thtough the Node) = no connection in CS.

I think that this is the reason why there are "Ghost Nodes" in CS. Those are the Nodes which have been made by Openstreetmaps (or the OSM community) AFTER the streets have been drawn to define this area as a street crossing.


(That´s also why the Mod "Move It" can (!) connect the streets (glue them together) but the game still can´t see it as a actual crossing)

I hope I make myself clear.

So 3 questions for all of you guys:

1. We can´t change every OSM Street so we can get a "perfect" Data in OSM, right? Or can we?

2. How can we identify the Fake Crossing Nodes in the OSM Data? One Idea I´m having is to find the same reference Node ID of two streets. This would mean, that this is crossing. ??

3. After we identified them: How does the algorithm look like, so we can fix the Data?

Or maybe we need to think more out of the box. Write a new Mode: "Every street crossing (even if there are different alitdudes) musst connect to a CS crossing." This would also connect the actual overpasses. But there are very few overpasses, right? Those can be corrected manually later on in the game fast.

You can also write me an Email: alexanderDOTgroemmer[ET]gmxDOTat
< >
Showing 1-7 of 7 comments
dopefish  [developer] Jan 20, 2020 @ 9:07am 
Hello, thank you for your investigations. It will certainly help me with finding the issue.
I'm trying hard to fix the intersections. Right now, this tool is not that big of a help, because you basically have to delete all roads in order to fix them. (the mod "Fine Road Anarchy does" help a lot with that)
I am still confident, that i'm able to find a solution. It's a bit hard to make as i cannot debug properly. There'll be an update, as soon as i fixed this.

Are you also from Linz? What a funny co-incident! Probably you're also trying to simulate this hell of traffic :P
Last edited by dopefish; Feb 17, 2020 @ 10:45am
Alexander Jan 21, 2020 @ 9:53am 
Hi. Yes, I´m from Linz. So are you kidding me? You are also from Linz? :)

@About OSM CS: My plan is, and you are right about that, to simulate Linz as excact as possible so I can simulate the traffic. I really would like to see how traffic will change (or not) if the "Westring" will be build, also the "Ostring", 2 Bridges, 3, 4, 5 ... What if there are Bycicle lanes perfectly organized etc.

What I really already perfected almost to 100% accurracy is an exact topographie (in HD, much better than in terrain.party. The "Rohrbacher Bundesstrasse" + "Railway" are fitting perfectly with your OSM. Also Highways...even "Hochstrasse" up to Pöstlingberg. It even looks like Linz from up there.

But we need to find a way to connect the streets just as me and you wrote. You are doing an awesome job. If I can help somehow plz let me know.

Latest thing I tried: Took one small part of OSM and imported it to JOSM and QGIS. As I accpected, streets are programmed to pass right through the crossing. I don´t know yet how I could tell JOSM or QGIS or maybe an other programm the magic spell: "Please splitt all lines at the point where a Node is". I think CS could then understand. There will be a lot of short road sections but they would be all connected and would let the "CS Cars" drive smoothly, right?

All the best, Alexander (From Auberg/Linz)
FightBiscuit Feb 10, 2020 @ 3:52am 
Hi! I hope this project is still running, because I have some thoughts too

I guess you have a dataset with every segment and its start and endpoint. So what you would have to do is compare every segment with every other segment (save some work by only comparing segments with similar x and y coordinates). The calculation should spit out the smallest distance between the segments as well as the middle point between them. If the smallest distance is below a certian value, a crossing should be created
Now you can delete these two segments and replace them with 4, with each segment going from one of the old segment end points to the calculated center point.

Of course the crossing generation should be dismissed if they already share an end point or one segment is below a certain legnth. Including the z axis in the distance calculation could preserve bridges.
Meisi Feb 19, 2020 @ 11:54pm 
@Dopefish, if you really need to compare every segment with each other segment, this sounds like a O(n²) algorithm and could be terribly slow. You could save some performance by approximating segment distances by using their start and end points first and using squared-distance measurements (x*x + y*y), as you are looking for relative distances only ("what is the smallest distance?"), instead of pythagorian distances ("what is the exact distance?"), which relies on slow squareroots (sqrt(x*x + y*y)). You may also need to check for point-to-line-SEGMENT distances (search for: "randy gaul distance point to line segment", I just used his algorithm in a project successfully) or even linesegment-linesegment-intersections, if endpoints don't end near crossings. Just leave me a PM if you need help! I think your MOD is dope!

Edit: I just saw your mod uses Unity. Should be easy to find the corrsponding intersection functions.
Last edited by Meisi; Feb 20, 2020 @ 10:43pm
Alexander Feb 26, 2020 @ 1:38pm 
I got some new information from the OSM Forum. I can´t understand a thing but maybe you guys. Sounds real helpful:



1. We can´t change every OSM Street so we can get a "perfect" Data in OSM, right? Or can we?

OSM Forum: Yes and no. Yes, you can edit any of them to improve OSM. No, I would not edit it into a certain format to simply make it work for you. The C:S plug-in is what needs to be changed, not OSM data.

2. How can we identify and re-write the Data so the Crossings are all identified 100%?

OSM Forum: The normal approach is to count by how many highways a node is referenced. Closed ways or P-shaped ways are special cases.
A node that is referenced more than once is a junction node.


Another good Hint:

OSM Forum: I assume you mean "crossroads" (or interections) where you say "crossings". Crossroads are not explicitly mapped in OSM; they are simply where several highway ways share a node. Your expectation that every situation should be mapped like your example "A" is simply wrong; it is the data consumer's task to infer these crossroads. Doing so is easy by looking at the node IDs that the various ways use; if several ways use a node with the same ID then there is a crossroads, otherwise there isn't - for example if there is a bridge or a tunnel, then even if the road going over another road should accidentally have a node in the same location it would be a node with a different ID.

No "fixing" in OSM is necessary; you just need to process the data correctly.

Adding to Frederik's answer: There are a number of tools that will take OSM data and import it into GIS enabled databases splitting ways as needed to create a valid node and edge routing graph. The one I've worked with is osm2pgrouting but there are others.

Hi everyone, I am also interested in making this mod to be avaliable. This mod can not run well now, there is some problem need to settle., there is some observation after trying to use it. Hope it will be useful.

As a gamer and a user of mod, The phenomenon I obeseved is the following,
1. To many nodes and even more than game data structure can handle.
2. The roads, especially the primary roads, morally speaking, is discnnected, maybe some of them are connected, but very few.
3. The primary roads and trunk roads are constructs by two side by side roads and they behaviour is weird.
4.This road information come from OSM is not very campatible with the
terrain information come from terrian.party, there is some road sinking into the ground and the others In a high place.
5.There is ONLY a very rough road level classification, basically equal to no.
6.Intersections and large intersections of roads are not well restored.

If we can handle 1-3, then this mod has value in real gaming process. If we can handle 1-6, then this is a fantastic mod. If sorting the difficulty of handlling these six questions, I think it should be 6>4>1\simeq 2\simeq 3 >5.

4 comes from the error of data, 6 need a very good approximation of curve in the rsstraction of number of nodes and road design rule in CSL, I do not know how to handle it now,
the 5th is a problem that takes enough time could be solved, in fact we can change the maping rule from OSM objects to CSL objects in dopefish's source code RoadMapping.cs.

The way to handle 1-3 is following, first the most important thing of us is not to draw a roads web that is very similar to real world , but is to make the result roads web we get as simiar as possible like the real one under the restraction we must comply with, so it is better to think the "road web" as a global thing, I mean, in C# or other programming language, it stored as a set, called A, and elements in this set is a segenment equipped with a given start point and a end point. Then consider the following problem: find a new set obel some new restraction and minimize the Hausforff distance with the set A, the new restraction is the segenments in the new set need to be connected, that is, the start point of most segemnts should be a end point of some others and reverse as well. the wiki page of "Hausdorff distance" https://en.wikipedia.org/wiki/Hausdorff_distance. The reason I do not directly use Ramer–Douglas–Peucker algorithm to simplify the nodes is because this algorithm is for one segement, but at once we change one road in the road web, the cross node of the changed road and the roads cross with it has a very large probability to change. So we need develop a new Ramer–Douglas–Peucker Type algorithm for this problem, it is a Recursive algorithm, the different with the classical RDP algorithm is that we need to add a if statement to get weather a new segenment is crossed with the already changed one, if it crossed with it we also should add a cross node in the node set of the new segement. So if there is m roads, one roads has at most n nodes, the complexity is no more than O(m*n*logn), and this algorithm is better be used scales by scales. Primary roads one scale and second road one more scale.
Kryptika Jan 30, 2021 @ 6:34am 
I cant load this - is it still working
< >
Showing 1-7 of 7 comments
Per page: 1530 50