Files
secondo/Algebras/OSM/Scripts/TuTestConnectivityCodes.sec

140 lines
4.6 KiB
Plaintext
Raw Permalink Normal View History

2026-01-23 17:03:45 +08:00
################################################################################
### Compares possible transistions with connectivity codes (optional)
################################################################################
### Description:
### - This script tests if transistions at junctions correspond to the computed
### connectivity codes in networks from imported OSM data.
### Please, see tu_osm_import.sh for further details.
###
### Preconditions:
###
### Postconditions:
###
### Author:
### - Thomas Uchdorf, thomas.uchdorf(at)fernuni-hagen.de
################################################################################
open database beispielCity;
delete CityNetwork;
delete TestRoads;
delete TestJunctions;
let TestRoads =
CityRoads feed
filter [(.Road = 1) or (.Road = 22)]
projectextend [Road, Length, Geometry;
Dual: ifthenelse(.Road = 1,TRUE,TRUE),
StartsSmaller: .StartsSmaller]
consume;
let TestJunctions =
CityJunctions feed
filter [(.Road1 = 1) and (.Road2 = 22)]
remove [NewJunctionType]
extend [NewJunctionType: 10920]
consume;
let CityNetwork = thenetwork(
1,
1.0,
TestRoads,
TestJunctions);
# Testing Transitions at junctions
# |
# o 8
# |
# o 4
# 5 1 | 3 7
# --o-o--x--o-o--
# |
# o 2
# |
# o 6
# |
delete Spot1;
delete Spot2;
delete Spot3;
delete Spot4;
delete Spot5;
delete Spot6;
delete Spot7;
delete Spot8;
let Spot1 =
point2gpoint(CityNetwork,[const point value(6800.0787 51236.7884)]);
let Spot2 =
point2gpoint(CityNetwork,[const point value(6800.7417 51236.2057)]);
let Spot3 =
point2gpoint(CityNetwork,[const point value(6801.3243 51236.0249)]);
let Spot4 =
point2gpoint(CityNetwork,[const point value(6801.1836 51236.6276)]);
let Spot5 =
point2gpoint(CityNetwork,[const point value(6799.7426 51236.9659)]);
let Spot6 =
point2gpoint(CityNetwork,[const point value(6800.6419 51236.1895)]);
let Spot7 =
point2gpoint(CityNetwork,[const point value(6801.5182 51235.9436)]);
let Spot8 =
point2gpoint(CityNetwork,[const point value(6801.2491 51236.7506)]);
delete Transitions;
let Transitions =
makearray(
ifthenelse(isdefined(shortest_path(Spot1,Spot3)),1,0),
ifthenelse(isdefined(shortest_path(Spot1,Spot5)),1,0),
ifthenelse(isdefined(shortest_path(Spot1,Spot4)),1,0),
ifthenelse(isdefined(shortest_path(Spot1,Spot2)),1,0),
ifthenelse(isdefined(shortest_path(Spot3,Spot7)),1,0),
ifthenelse(isdefined(shortest_path(Spot3,Spot1)),1,0),
ifthenelse(isdefined(shortest_path(Spot3,Spot4)),1,0),
ifthenelse(isdefined(shortest_path(Spot3,Spot2)),1,0),
ifthenelse(isdefined(shortest_path(Spot2,Spot3)),1,0),
ifthenelse(isdefined(shortest_path(Spot2,Spot1)),1,0),
ifthenelse(isdefined(shortest_path(Spot2,Spot4)),1,0),
ifthenelse(isdefined(shortest_path(Spot2,Spot6)),1,0),
ifthenelse(isdefined(shortest_path(Spot4,Spot3)),1,0),
ifthenelse(isdefined(shortest_path(Spot4,Spot1)),1,0),
ifthenelse(isdefined(shortest_path(Spot4,Spot8)),1,0),
ifthenelse(isdefined(shortest_path(Spot4,Spot2)),1,0));
save Transitions to '/Users/fernuni-student/secondo/Algebras/OSM/Scripts/Exported/10920.txt';
#let Transitions =
# [const rel(tuple([
# AupAup: int,
# AupAdown: int,
# AupBup: int,
# AupBdown: int,
# AdownAup: int,
# AdownAdown: int,
# AdownBup: int,
# AdownBdown: int,
# BupAup: int,
# BupAdown: int,
# BupBup: int,
# BupBdown: int,
# BdownAup: int,
# BdownAdown: int,
# BdownBup: int,
# BdownBdown: int,
# cc: int
# ]))
# value ()];
#update Transitions :=
# (ifthenelse(isdefined(shortest_path(Spot1,Spot3)),1,0)
# ifthenelse(isdefined(shortest_path(Spot1,Spot5)),1,0)
# ifthenelse(isdefined(shortest_path(Spot1,Spot4)),1,0)
# ifthenelse(isdefined(shortest_path(Spot1,Spot2)),1,0)
# ifthenelse(isdefined(shortest_path(Spot3,Spot7)),1,0)
# ifthenelse(isdefined(shortest_path(Spot3,Spot1)),1,0)
# ifthenelse(isdefined(shortest_path(Spot3,Spot4)),1,0)
# ifthenelse(isdefined(shortest_path(Spot3,Spot2)),1,0)
# ifthenelse(isdefined(shortest_path(Spot2,Spot3)),1,0)
# ifthenelse(isdefined(shortest_path(Spot2,Spot1)),1,0)
# ifthenelse(isdefined(shortest_path(Spot2,Spot4)),1,0)
# ifthenelse(isdefined(shortest_path(Spot2,Spot6)),1,0)
# ifthenelse(isdefined(shortest_path(Spot4,Spot3)),1,0)
# ifthenelse(isdefined(shortest_path(Spot4,Spot1)),1,0)
# ifthenelse(isdefined(shortest_path(Spot4,Spot8)),1,0)
# ifthenelse(isdefined(shortest_path(Spot4,Spot2)),1,0)
# 10920);
close database;