-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlrs.fbs
168 lines (132 loc) · 5.5 KB
/
lrs.fbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
file_identifier "LRSD";
table Property {
key:string (required, key);
value:string (required);
}
table Lrs {
properties:[Property];
/// Networks are segments connected by nodes.
/// There can be multiple networks, such as railway tracks and lines, sewer pipe and power lines.
networks:[Network] (required);
anchors:[Anchor] (required);
linear_referencing_methods:[LinearReferencingMethod] (required);
/// There can be multiple geometries
/// For instance a geographic and and schematic representation of the same network
views:[GeometryView] (required);
}
// NETWORK DEFINITION
/// A collection of nodes, linked by segments.
/// It could be a network of roads, sewer pipes, railway tracks, or something abstract, such as railway lines.
table Network {
id:string (required);
segments:[Segment] (required);
nodes:[Node] (required);
/// Each network has traversals, which can be thought of as roads, railway lines, tracks, paths or trips.
traversals:[Traversal] (required);
}
/// A continuous link between two network nodes. Segments can be located in space.
/// It could be a section of roads between intersections, a piece of railway tracks without switches, a continuous piece of sewer pipe.
/// Segments are directed: one of its ends of the segments is its begining, and the other its ends.
table Segment {
id:string (required);
properties:[Property];
}
/// Nodes are connections between segment endpoints.
/// A node can have a single connection (at the end of a dead end), or multiple segment connections (at an intersection).
/// Nodes can be used to model point of interest in a network, such as road intersections, railway switches, the end of a dead ends.
table Node {
id:string (required);
properties:[Property];
connections:[Connection] (required);
}
enum Endpoint : byte { Unknown = 0, Begin = 1, End = 2 }
/// A connection links a node to a segment
table Connection {
properties:[Property];
segment_index:uint64;
/// A segment is oriented. The endpoint indicates what end of the segment is connected to the node
endpoint:Endpoint;
}
/// A traversal is a path in a network.
/// Traversals may be used to model roads, railway tracks, railway lines or trips.
/// Traversals are defined as a sequence of segment and direction pairs.
enum Direction : byte { Increasing = 1, Decreasing = 2 }
table Traversal {
id:string (required);
// Segments and directions are meant to be iterated over simultaneously.
// segments.size() == directions.size()
segments:[uint64] (required);
directions:[Direction] (required);
}
struct NodeRef {
network_index:uint32;
node_index:uint64;
}
struct TraversalRef {
network_index:uint32;
traversal_index:uint64;
}
// LRM DEFINITION
/// Anchors are reference locations, used for positioning within a linear referencing method.
/// There are two types of anchors:
/// * most anchors are standalone reference locations, such as milestones or kilometer markers
/// * some anchors are associated with a network node. The location of the anchor is deduced from the location of the node.
table Anchor {
id:string (required);
/// Most anchors have a name, which is used to reference the location.
/// More often than not a kilometer or mile number, but it can also be a letter or word.
name:string;
/// Anchors can be bound to a node, or defined independently.
/// If the anchor is bound to a node, it's location is deduced from location of the node.
node:NodeRef;
}
enum DistanceUnit : byte { Meters, MilliMeters }
/// Linear referencing methods (LRMs) are curves in space, along which distances can be measured.
/// Each linear referencing method has:
/// * a network traversal, which defines the path of the curve
/// * a sequence of anchors, which are projected on the curve, and used as positioning reference points
/// * distances between anchors have to be defined: even though distances can be measured on the curve,
// it can be imprecise enough to joepardize correct ordering of object positionned relative to different reference points
table LinearReferencingMethod {
id:string (required);
properties:[Property];
traversal_index:TraversalRef;
/// An LRM can apply to multiple referals
/// For instance a LRM can be the central line of a highway
/// And that LRM is the reference for the two other traversals corresponding to each direction
used_on:[TraversalRef];
anchor_indices:[uint64] (required);
distances:[uint64] (required);
/// The unit used to measure the distance between anchors
distance_unit:DistanceUnit = Meters;
/// The unit used to express measures relative to anchors (12+230)
measure_unit:DistanceUnit = Meters;
}
// GEOMETRY DEFINITION
struct Point {
x:float64;
y:float64;
z:float64;
}
enum GeometryType : byte { Geographic = 1, Schematic = 2 }
table GeometryView {
properties:[Property];
geometry_type:GeometryType = Geographic;
anchors:[AnchorGeometry] (required);
/// Must be the same size as the top level network array
networks:[NetworkGeometry] (required);
}
table AnchorGeometry {
/// Anchors only have a geometry when not linked to a network node
/// The value is null if it is linked to a network node
geom:Point;
}
/// The geometry for a given network
table NetworkGeometry {
/// Must have as many linestrings as the network has segments
segments:[SegmentGeometry] (required);
}
table SegmentGeometry {
points:[Point] (required);
}
root_type Lrs;