200 lines
6.0 KiB
Plaintext
200 lines
6.0 KiB
Plaintext
|
|
################################################################################
|
||
|
|
### Creating networks from imported OSM data (8 / 11)
|
||
|
|
################################################################################
|
||
|
|
### Description:
|
||
|
|
### - This script creates a relation containing junctions between two sections
|
||
|
|
### belonging to two Streets.
|
||
|
|
### (the number 1 in the relation name stands for incoming, the number 2 means
|
||
|
|
### outgoing)
|
||
|
|
### Please, see tu_shp_import.sh for further details.
|
||
|
|
###
|
||
|
|
### Preconditions:
|
||
|
|
### - activated necessary algebras
|
||
|
|
### - existing open database with successfully imported osm data
|
||
|
|
### - FullSectionsView-relation
|
||
|
|
###
|
||
|
|
### Postconditions:
|
||
|
|
### - twoSecJuncBtwTwoSts-relation
|
||
|
|
### twoSecJuncBtwTwoSts: rel{Road1: int, Pos1: double, Road2: int,
|
||
|
|
### Pos2: double, JunctionType: int}
|
||
|
|
###
|
||
|
|
### Author:
|
||
|
|
### - Thomas Uchdorf, thomas.uchdorf(at)fernuni-hagen.de
|
||
|
|
################################################################################
|
||
|
|
|
||
|
|
# |
|
||
|
|
# |
|
||
|
|
# |
|
||
|
|
# v
|
||
|
|
#----->xxxxxx
|
||
|
|
# x
|
||
|
|
# x
|
||
|
|
# x
|
||
|
|
# x
|
||
|
|
let TwoSecInZeroSecOut11JuncTmp =
|
||
|
|
((NodesRel feed
|
||
|
|
FullSectionsView feed
|
||
|
|
sortby [SectionId]
|
||
|
|
filter [(.StreetEndNodeId = .EndNodeId) and
|
||
|
|
not(.StreetStartNodeId = .StreetEndNodeId)]
|
||
|
|
project [StreetId,SectionId,EndNodeId,StreetData,SectionData,
|
||
|
|
OneWay] {a}
|
||
|
|
hashjoin [NodeId, endNodeId_a,99997])
|
||
|
|
FullSectionsView feed
|
||
|
|
sortby [SectionId]
|
||
|
|
filter [(.StreetEndNodeId = .EndNodeId) and
|
||
|
|
not(.StreetStartNodeId = .StreetEndNodeId)]
|
||
|
|
project [StreetId,SectionId,EndNodeId,StreetData,SectionData,
|
||
|
|
OneWay] {b}
|
||
|
|
hashjoin [NodeId,EdNodeId_b,99997]
|
||
|
|
filter [.SectionId_a < .SectionId_b])
|
||
|
|
projectextend [;
|
||
|
|
Road1: .StreetId_a,
|
||
|
|
Pos1: atpoint(.StreetData_a,.Node,TRUE),
|
||
|
|
Road2: .StreetId_b,
|
||
|
|
Pos2: atpoint(.StreetData_b,.Node,TRUE),
|
||
|
|
JunctionType:
|
||
|
|
getconnectivitycode(1,2,0,0,.OneWay_a = 1,.OneWay_b = 1,FALSE,FALSE),
|
||
|
|
Sec1: .SectionId_a,
|
||
|
|
Sec2: .SectionId_b,
|
||
|
|
Node: .Node,
|
||
|
|
SecData1: .SectionData_a,
|
||
|
|
SecData2: .SectionData_b]
|
||
|
|
filter [not(.Road1 = .Road2)]
|
||
|
|
consume;
|
||
|
|
|
||
|
|
# ^
|
||
|
|
# |
|
||
|
|
# |
|
||
|
|
# |
|
||
|
|
#----->xxxxxx
|
||
|
|
# x
|
||
|
|
# x
|
||
|
|
# x
|
||
|
|
# x
|
||
|
|
let OneSecInOneSecOut12JuncTmp =
|
||
|
|
((NodesRel feed
|
||
|
|
FullSectionsView feed
|
||
|
|
sortby [SectionId]
|
||
|
|
filter [(.StreetEndNodeId = .EndNodeId) and
|
||
|
|
not(.StreetStartNodeId = .StreetEndNodeId)]
|
||
|
|
project [StreetId,SectionId,EndNodeId,StreetData,SectionData,
|
||
|
|
OneWay] {a}
|
||
|
|
hashjoin [NodeId, EndNodeId_a,99997])
|
||
|
|
FullSectionsView feed
|
||
|
|
sortby [SectionId]
|
||
|
|
filter [(.StreetStartNodeId = .StartNodeId) and
|
||
|
|
not(.StreetStartNodeId = .StreetEndNodeId)]
|
||
|
|
project [StreetId,SectionId,StartNodeId,StreetData,SectionData,
|
||
|
|
OneWay] {b}
|
||
|
|
hashjoin [NodeId,StartNodeId_b,99997]
|
||
|
|
filter [.SectionId_a < .SectionId_b])
|
||
|
|
projectextend [;
|
||
|
|
Road1: .StreetId_a,
|
||
|
|
Pos1: atpoint(.StreetData_a,.Node,TRUE),
|
||
|
|
Road2: .StreetId_b,
|
||
|
|
Pos2: atpoint(.StreetData_b,.Node,TRUE),
|
||
|
|
JunctionType:
|
||
|
|
getconnectivitycode(1,1,0,0,.OneWay_a = 1,.OneWay_b = 1,FALSE,FALSE),
|
||
|
|
Sec1: .SectionId_a,
|
||
|
|
Sec2: .SectionId_b,
|
||
|
|
Node: .Node,
|
||
|
|
SecData1: .SectionData_a,
|
||
|
|
SecData2: .SectionData_b]
|
||
|
|
filter [not(.Road1 = .Road2)]
|
||
|
|
consume;
|
||
|
|
|
||
|
|
# |
|
||
|
|
# |
|
||
|
|
# |
|
||
|
|
# v
|
||
|
|
#<-----xxxxxx
|
||
|
|
# x
|
||
|
|
# x
|
||
|
|
# x
|
||
|
|
# x
|
||
|
|
let OneSecInOneSecOut21JuncTmp =
|
||
|
|
((NodesRel feed
|
||
|
|
FullSectionsView feed
|
||
|
|
sortby [SectionId]
|
||
|
|
filter [(.StreetStartNodeId = .StartNodeId) and
|
||
|
|
not(.StreetStartNodeId = .StreetEndNodeId)]
|
||
|
|
project [StreetId,SectionId,StartNodeId,StreetData,SectionData,
|
||
|
|
OneWay] {a}
|
||
|
|
hashjoin [NodeId, StartNodeId_a,99997])
|
||
|
|
FullSectionsView feed
|
||
|
|
sortby [SectionId]
|
||
|
|
filter [(.StreetEndNodeId = .EndNodeId) and
|
||
|
|
not(.StreetStartNodeId = .StreetEndNodeId)]
|
||
|
|
project [StreetId,SectionId,EndNodeId,StreetData,SectionData,
|
||
|
|
OneWay] {b}
|
||
|
|
hashjoin [NodeId,EndNodeId_b,99997]
|
||
|
|
filter [.SectionId_a < .SectionId_b])
|
||
|
|
projectextend [;
|
||
|
|
Road1: .StreetId_a,
|
||
|
|
Pos1: atpoint(.StreetData_a,.Node,TRUE),
|
||
|
|
Road2: .StreetId_b,
|
||
|
|
Pos2: atpoint(.StreetData_b,.Node,TRUE),
|
||
|
|
JunctionType:
|
||
|
|
getconnectivitycode(2,2,0,0,.OneWay_a = 1,.OneWay_b = 1,FALSE,FALSE),
|
||
|
|
Sec1: .SectionId_a,
|
||
|
|
Sec2: .SectionId_b,
|
||
|
|
Node: .Node,
|
||
|
|
SecData1: .SectionData_a,
|
||
|
|
SecData2: .SectionData_b]
|
||
|
|
filter [not(.Road1 = .Road2)]
|
||
|
|
consume;
|
||
|
|
|
||
|
|
# ^
|
||
|
|
# |
|
||
|
|
# |
|
||
|
|
# |
|
||
|
|
#<-----xxxxxx
|
||
|
|
# x
|
||
|
|
# x
|
||
|
|
# x
|
||
|
|
# x
|
||
|
|
let ZeroSecInTwoSecOut22JuncTmp =
|
||
|
|
((NodesRel feed
|
||
|
|
FullSectionsView feed
|
||
|
|
sortby [SectionId]
|
||
|
|
filter [(.StreetStartNodeId = .StartNodeId) and
|
||
|
|
not(.StreetStartNodeId = .StreetEndNodeId)]
|
||
|
|
project [StreetId,SectionId,StartNodeId,StreetData,SectionData,
|
||
|
|
OneWay] {a}
|
||
|
|
hashjoin [NodeId, StartNodeId_a,99997])
|
||
|
|
FullSectionsView feed
|
||
|
|
sortby [SectionId]
|
||
|
|
filter [(.StreetStartNodeId = .StartNodeId) and
|
||
|
|
not(.StreetStartNodeId = .StreetEndNodeId)]
|
||
|
|
project [StreetId,SectionId,StartNodeId,StreetData,SectionData,
|
||
|
|
OneWay] {b}
|
||
|
|
hashjoin [NodeId,startNodeId_b,99997]
|
||
|
|
filter [.SectionId_a < .SectionId_b])
|
||
|
|
projectextend [;
|
||
|
|
Road1: .StreetId_a,
|
||
|
|
Pos1: atpoint(.StreetData_a,.Node,TRUE),
|
||
|
|
Road2: .StreetId_b,
|
||
|
|
Pos2: atpoint(.StreetData_b,.Node,TRUE),
|
||
|
|
JunctionType:
|
||
|
|
getconnectivitycode(2,1,0,0,.OneWay_a = 1,.OneWay_b = 1,FALSE,FALSE),
|
||
|
|
Sec1: .SectionId_a,
|
||
|
|
Sec2: .SectionId_b,
|
||
|
|
Node: .Node,
|
||
|
|
SecData1: .SectionData_a,
|
||
|
|
SecData2: .SectionData_b]
|
||
|
|
filter [not(.Road1 = .Road2)]
|
||
|
|
consume;
|
||
|
|
|
||
|
|
# Creating the union
|
||
|
|
let TwoSecJuncBtwTwoSts =
|
||
|
|
((TwoSecInZeroSecOut11JuncTmp feed
|
||
|
|
OneSecInOneSecOut12JuncTmp feed
|
||
|
|
concat)
|
||
|
|
OneSecInOneSecOut21JuncTmp feed
|
||
|
|
concat)
|
||
|
|
ZeroSecInTwoSecOut22JuncTmp feed
|
||
|
|
concat
|
||
|
|
consume;
|
||
|
|
|