|
|
|
|
|
|
84
|
Blob[]
|
84
|
Blob[]
|
|
85
|
├── HeaderBlock
|
85
|
├── HeaderBlock
|
|
86
|
└── PrimitiveBlock
|
86
|
└── PrimitiveBlock
|
|
87
|
- └── Group[]
|
|
|
|
|
|
87
|
+ └── PrimitiveGroup[]
|
|
88
|
├── Node[]
|
88
|
├── Node[]
|
|
89
|
├── DenseNodes
|
89
|
├── DenseNodes
|
|
90
|
├── Way[]
|
90
|
├── Way[]
|
|
91
|
└── Relation[]
|
91
|
└── Relation[]
|
|
92
|
```
|
92
|
```
|
|
93
|
|
93
|
|
|
94
|
-At the highest level a PBF file consists of a sequence of Blobs. Each Blob can
|
|
|
|
95
|
-be decoded into either a HeaderBlock or a PrimitiveBlock.
|
|
|
|
|
|
94
|
+At the highest level a PBF file consists of a sequence of blobs. Each `Blob` can
|
|
|
|
95
|
+be decoded into either a `HeaderBlock` or a `PrimitiveBlock`.
|
|
96
|
|
96
|
|
|
97
|
-Iterating over Blobs is very fast, but decoding might involve a more expensive
|
|
|
|
|
|
97
|
+Iterating over blobs is very fast, but decoding might involve a more expensive
|
|
98
|
decompression step. So especially for larger files it is advisable to
|
98
|
decompression step. So especially for larger files it is advisable to
|
|
99
|
-parallelize at the Blob level as each Blob can be decompressed independently.
|
|
|
|
|
|
99
|
+parallelize at the blob level as each blob can be decompressed independently.
|
|
|
|
100
|
+(See the `reader` module in this library for parallel methods)
|
|
100
|
|
101
|
|
|
101
|
-Usually the first Blob of a file decodes to a HeaderBlock which holds global
|
|
|
|
102
|
-information for all following PrimitiveBlocks, such as a list of required
|
|
|
|
|
|
102
|
+Usually the first `Blob` of a file decodes to a `HeaderBlock` which holds global
|
|
|
|
103
|
+information for all following `PrimitiveBlocks`, such as a list of required
|
|
103
|
parser features.
|
104
|
parser features.
|
|
104
|
|
105
|
|
|
105
|
-A PrimitiveBlock contains an array of Groups (named `PrimitiveGroup` in
|
|
|
|
106
|
-osmformat.proto). Each Group only contains one element type: Node, Way,
|
|
|
|
107
|
-Relation or DenseNodes. A DenseNodes item is an alternative and space-saving
|
|
|
|
108
|
-representation of a Node array. So, do not forget to check for DenseNodes when
|
|
|
|
109
|
-aggregating all nodes in a file.
|
|
|
|
|
|
106
|
+A `PrimitiveBlock` contains an array of `PrimitiveGroup`s. Each `PrimitiveGroup`
|
|
|
|
107
|
+only contains one element type: `Node`, `Way`, `Relation` or `DenseNodes`. A
|
|
|
|
108
|
+`DenseNodes` item is an alternative and space-saving representation of a `Node`
|
|
|
|
109
|
+array. So, do not forget to check for `DenseNodes` when aggregating all nodes in
|
|
|
|
110
|
+a file.
|
|
110
|
|
111
|
|
|
111
|
Elements reference each other using integer IDs. Corresponding elements could be
|
112
|
Elements reference each other using integer IDs. Corresponding elements could be
|
|
112
|
-stored in any Blob, so finding them can involve iterating over the whole file.
|
|
|
|
113
|
-Some files declare an optional feature "Sort.Type\_then\_ID" in the HeaderBlock to
|
|
|
|
114
|
-indicate that elements are stored sorted by their type and then ID. This can be
|
|
|
|
115
|
-used to dramatically reduce the search space.
|
|
|
|
|
|
113
|
+stored in any blob, so finding them can involve iterating over the whole file.
|
|
|
|
114
|
+Some files declare an optional feature "Sort.Type\_then\_ID" in the
|
|
|
|
115
|
+`HeaderBlock` to indicate that elements are stored sorted by their type and then
|
|
|
|
116
|
+ID. This can be used to dramatically reduce the search space.
|
|
116
|
|
117
|
|
|
117
|
# License
|
118
|
# License
|
|
118
|
|
119
|
|