################################################################################ ### Creating networks from imported OSM data (11 / 11) ################################################################################ ### Description: ### - This script creates networks from imported OSM data. ### Please, see tu_oms_import.sh for further details. ### ### Preconditions: ### - activated necessary algebras ### - existing open database with successfully imported osm data ### - ExtStreetsRel-relation ### ExtStreetsRel: rel{GeoData: sline, StreetId: int, Name: string, ref: string, ### RoadClass: string, oneWay: int, bridge: int, ### maxSpeed: int, tunnel: bool, layer: int, groupId: int} ### - twoSecJuncBtwTwoSts-relation ### twoSecJuncBtwTwoSts: rel{Road1: int, Pos1: double, Road2: int, ### Pos2: double, JunctionType: int} ### - threeSecJuncBtwTwoSts-relation ### threeSecJuncBtwTwoSts: rel{Road1: int, Pos1: double, Road2: int, ### Pos2: double, JunctionType: int} ### - fourSecJuncBtwTwoSts-relation ### fourSecJuncBtwTwoSts: rel{Road1: int, Pos1: double, Road2: int, ### Pos2: double, JunctionType: int} ### ### Postconditions: ### - CityRoads-relation ### CityRoads: rel{Name: string, Road: int, Length: double, Geometry: line, ### Dual: bool, StartsSmaller: bool, RoadLevel: int} ### - CityJunctions-relation ### CityJunctions: rel{Road1: int, Pos1: double, Road2: int, Pos2: double, ### JunctionType: int} ### - CityNetwork-network ### ### Author: ### - Thomas Uchdorf, thomas.uchdorf(at)fernuni-hagen.de ################################################################################ # Making a relation with Road data to enable network creation # see also PaperMon-paper page 11 let CityRoads = ExtStreetsRel feed projectextend [; Name : .Name, Road: .StreetId, Length: size(.GeoData), Geometry: .GeoData, Dual: .oneWay=0, StartsSmaller: get_startsmaller(.GeoData), RoadLevel : .RoadClassRef] consume; # Calculating and inserting Road measures into a new relation containing # junction data # see also PaperMon-paper page 11 let CityJunctionsTmp = ((TwoSecJuncBtwTwoSts feed extend [NumSecs: 2] project [Road1,Pos1,Road2,Pos2,JunctionType,NumSecs] ThreeSecJuncBtwTwoSts feed extend [NumSecs: 3] project [Road1,Pos1,Road2,Pos2,JunctionType,NumSecs] concat) FourSecJuncBtwTwoSts feed extend [NumSecs: 4] project [Road1,Pos1,Road2,Pos2,JunctionType,NumSecs] concat) consume; # should not make a difference since the combined junctions are composed in a # disjunct way let CityJunctions = CityJunctionsTmp feed sortby[Road1,Pos1,Road2,Pos2] groupby [Road1,Pos1,Road2,Pos2; NewJunctionType: group feed aggregateB [JunctionType; fun(A:int,B:int) binor(A,B); 0]] consume; # Creating the network let CityNetwork = thenetwork( 1, 0.0001, (CityRoads feed project [Road, Length, Geometry, Dual, StartsSmaller] consume), CityJunctions feed projectextend[Road1, Pos1, Road2, Pos2; NewJunctionType: 65535] consume); close database;