TMC/TMC Import Germany/automatic import

From OpenStreetMap Wiki
Jump to: navigation, search

Rules for automatically importing as much as possible:


Contents

automatic import

Identifying the 2 nodes (one for each direction) of a motorway-junction for a motorway-junction in the LCL should be easy as there are at all times 2 such nodes in OSM and they are the only ones in close proximity to the point from the LCL.

Rules for Roads

Roads are imported first

For roads with a roadnumber of the kind "A[0-9]*" we can find the corresponding relation by doing:

For roads with a roadnumber of the kind "B[0-9]*" or "B[0-9]*a" or "B[0-9]R" we can find the corresponding relation by doing:

For roads with a roadnumber of the kind "L[0-9]*", "S[0-9]*", "K [A-Z]*[0-9]*" ([A-Z]*[0-9]*=licence plate), "G[A-Zo0-9 ]*" we can find the corresponding relation by doing:

See also:


 foreach(road having road.already_imported=false) {
   relation rel = find(RELATION, ref=road.ROADNUMBER)
   if (rel = null) {
      rel = buildRelation(road.ROADNUMBER, find(WAY, ref=road.ROADNUMBER))
   }
   // matching start, end and via are NOT checked

   foreach(way in rel with role="") {
      foreach(segment in road.segments) {
         find_and_tag_segment(rel, segment);
      }
      tag_road(road, rel);
      road.already_imported=true;
   }
 }

Rules for Segments

Segments are imported second. (Thus only segments not belonging to a roads are tagged this way)

For segments with a roadnumber of the kind "A[0-9]*" we can find the corresponding relation by doing:

For segments with a roadnumber of the kind "B[0-9]*" or "B[0-9]*a" we can find the corresponding relation by doing:

For segments with a roadnumber of the kind "L[0-9]*", "S[0-9]*", "K[A-Z0-9 ]*" we can find the corresponding relation by doing:


 foreach(segment having segment.already_imported=false) {
   relation rel = find(RELATIION, segment.ROADNUMBER)
   if (rel != null) {
      find_and_tag_segment(rel, segment)
   }
 }
 foreach(segment having segment.already_imported=false) {
    find_and_tag_segment(find(WAY, ref=road.ROADNUMBER), segment)
 }

 find_and_tag_segment(Relation rel, segment) {
    find_and_tag_segment(rel.getMembers(WAY, role=""), segment)
 }

 find_and_tag_segment(Way[] ways, segment) {
    Node[] start = findNode(ways, segment.points[0],          getPOIAttributes(segment.points[0]))
    Node[] end   = findNode(ways, segment.points[last],       getPOIAttributes(segment.points[last]))
    Node[][] via = findNode(ways, segment.points[1..last-1], ([etPOIAttributes(segment.points[1..last-1]]))

    Route forward = findRoute(start, end, via);
    Route revere = findRoute(end, start, via);
    if (forward != null && revere != null) {
        if (forward == reverse) {
           tag_segment(road, rel);
           foreach(point in segment.points) {
               tag_point(forward.findNode(point, getPOIAttributes(point)));
           }
        } else {
           tag_segment(road, rel, "direction=forward");
           foreach(point in segment.points) {
               tag_point(forward.findNode(point, getPOIAttributes(point), "direction=forward"));
           }

           tag_segment(road, rel, "direction=reverse");
           foreach(point in segment.points) {
               tag_point(reverse.findNode(point, getPOIAttributes(point), "direction=reverse"));
           }
        }
        
        segment.already_imported=true;
    }
 }


If we find such a relation:

The resulting relations neeed to be checked to:

Rules for Points

points are imported last. (Thus only points not belonging to a segment are tagged this way)

 foreach(Point having point.already_imported=false) {
   Node node = findNearestNode(point.location, and("has ways with highway=*", getPOIAttributes(point)))
   if (node == null) {
      node = new Node(point.location, getPOIAttributes(point));
   }
   tag_node(node);
   point.already_imported=true;
 }

 getPOIAttributes(point) {
   if (point.class=3 && point.subclass=11) {
      return "amenity=fuel";
   }
   ...
 }


Rules for Areas

TODO

type/subtype-codes from the LCL

These are the codes and subcodes applied to LCL-locations for Germany. Where known their mapping to OSM-tags has been added.


type/subtype-codes in actual usage

This short analysis was only done on the LCL of Germany. Other countries may use other types and subtypes.

Types and their (sub)classes that are in actual use
in the German TMC LocationCodeList provided by BASt
2009-04
compiled by Marcus Wolscho <Marcus@Wolschon.biz>

=====================
total: 16966 intersections
(intersections have no classes, only a location-code)

=====================
total: 932 other areas
CLASS; TypeCoDe; SubTypeCoDe;comment

A;5;2;;lake;2;Binnensee
A;6;1;;Tourist area;1;touristisches Gebiet
A;6;2; only one;Metropolitan Area;2;Ballungsraum
A;6;3; very few;Industrial area;3;Industrieregion
A;6;4;;Traffic area;4;Verkehrsgebiet
A;6;5; very few;Meterological area;5;meterologisches Gebiet
A;6;7; very few;Park and ride site;7;Park + Ride Bereich
A;6;8;;Car park area;8;Parkzone
A;12;0;;Application region;12;Teilgebiet

=====================
total: 6135 administrative areas
CLASS; TypeCoDe; SubTypeCoDe;comment
A;1;0; (only 1 time);Continent;1;Kontinent
A;3;0;Country;3;Land
A;7;0;Order 1 area;7;Bundesland
A;8;0;Order 2 area;8;Regierungsbezirk
A;9;1;Rural county;1;Kreis/Landkreis
A;9;2;Urban county;2;Kreisfreie Stadt
A;10;0;Order 4 area;10;Gemeinde/Stadt
A;11;0;Order 5 area;11;Gemeindeteil

=====================
total: 2889 roads
CLASS; TypeCoDe; SubTypeCoDe;comment
L;1;1;Motorway;1;Autobahn
L;1;2;1st class Road;2;Bundesstraße
L;1;3;2nd class Road;3;Landes- oder Staatsstraße
L;1;4;3rd class Road;4;Kreisstraße
L;2;1;(only 1 time);Ring motorway;1;Autobahnring
L;2;2;;Other ring road;2;Ringstraße
L;5;0;;unknown
L;6;1;;Ferry;1;Fährverbindung
L;6;2;(only 1 time);Vehicular rail link;2;Autoreisezugverbindung

=====================
total: 1699 segments
CLASS; TypeCoDe; SubTypeCoDe;comment
L;3;0;ROADNUMBER is at all times B??? or A??? or S??? = the "ref"-tag in OSM;Segment for 1st order

=====================
total: 28520 points

CLASS; TypeCoDe; SubTypeCoDe;comment
P;1;1;;Motorway intersection;1;Autobahnkreuz
P;1;2;;Motorway triangle;2;Autobahndreieck
P;1;3;;Motorway junction;3;Autobahnanschlussstelle
P;1;4;;Motorway exit;4;Autobahnausfahrt
P;1;5;;Motorway entrance;5;Autobahnauffahrt
P;1;6;;Flyover;6;Überführung
P;1;7;;Underpass;7;Unterführung
P;1;8;;Roundabout;8;Kreisverkehr
P;1;9;;Gyratory;9;Kreisführung um Plätze
P;1;10;;Traffic lights;10;Ampelkreuzung
P;1;11;;Cross road;11;Kreuzung
P;1;12;;T-junction;12;Einmündung
P;1;13;;Intermediate node;13;Übergang
P;1;14;;Connection;14;Verbindungsstraße
P;1;15;;Exit;15;Anschlussstelle
P;2;1; (only 2 times);Distance marker;1;Streckenmarke
P;3;1;;Tunnel;1;Tunnel
P;3;2;;Bridge;2;Brücke
P;3;3;;Service area;3;Raststätte
P;3;4;;Rest area;4;Rastplatz
P;3;5; (only 3 times);View point;5;Aussichtspunkt
P;3;7;;Park and ride site;7;P&R-Parkplatz
P;3;8;;Car park;8;Parkplatz
P;3;9; (only 2 times);Kiosk;9;Parkplatz mit Kiosk
P;3;10;;Kiosk with WC;10;Parkplatz mit Kiosk & WC
P;3;11;;Petrol station;11;Tankstelle
P;3;12;;Petrol station with kiosk;12;Tankstelle mit Kiosk
P;3;13; (only 1 time);Motel;13;Motel
P;3;14;;Border/frontier;14;Grenzübergang
P;3;15; (only 1 time);Customs post;15;Zollstation
P;3;16; (only 1 time);Toll plaza;16;Mautstation
P;3;17;;Ferry terminal;17;Fähranleger
P;3;18; (only 4 times);Harbour;18;Hafen
P;3;19;;Square;19;Platz
P;3;20; (only 1 time);Fair;20;Marktplatz/Festplatz
P;3;21;;Garage;21;Parkhaus
P;3;23;;Retail park;23;Einkaufszentrum
P;3;24;;Theme park;24;Freizeitpark
P;3;25;;Tourist attraction;25;Sehenswürdigkeit
P;3;27;;Airport;27;Flughafen
P;3;28;;Station;28;Bahnhof
P;3;29;;Hospital;29;Krankenhaus
P;3;30; (only 2 times);Church;30;Kirche
P;3;31;;Stadium;31;Stadion
P;3;33;;Castle;33;Burg
P;3;35;;Exhibition/convention centre;35;Messe-/Kongresszentrum
P;3;37;;Place name;37;benannter Punkt
P;3;38; (only 1 time);Dam;38;Damm
P;3;41; (only 1 time);Lock;41;Schleuse
P;3;42; (only 1 time);Mountain crossing/pass;42;Pass
P;3;43; (only 3 times);Railroad crossing;43;Bahnübergang
P;3;45;;Ferry;45;Fähre
P;3;46;;Industrial area;46;Industriegebiet
P;3;47; (only 1 time);Viaduct;47;Viadukt
P;5;1;;Underground parking garage;1;Tiefgarage
P;5;2;;Car park;2;Parkplatz
P;5;3;;Parking garage;3;Parkhaus
P;5;5;;Park and ride side;5;P&R-Parkplatz
P;6;4;;Tunnel;4;Tunnel
P;6;6; (only 2 times);Ferry;6;Fähre
P;6;8; (only 1 time);Fair;8;Marktplatz/Festplatz
P;6;9; (only 1 time);Retail park;9;Einkaufszentrum
P;6;12;;Stadium;12;Stadion
P;6;13; (only 1 time);Exhibition/convention centre;13;Messe/Kongresszentrum
P;6;14; (only 1 time);Place name;14;Benannter Punkt


Intersections

TMCImport Screenshot.jpg

algorithm:

mapping:

Areas

POIs

algorithm:

mapping:



Road-Features

algorithm:

mapping:


Personal tools
Namespaces
Variants
Actions
site
Toolbox