Warning, /education/marble/tools/osm-addresses/pbf/osmformat.proto is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2010 Scott A. Crosby. <scott@sacrosby.com>
0003
0004 SPDX-License-Identifier: GPL-3.0-or-later
0005 */
0006
0007 option optimize_for = LITE_RUNTIME;
0008 option java_package = "crosby.binary";
0009 package OSMPBF;
0010
0011 /* OSM Binary file format
0012
0013 This is the master schema file of the OSM binary file format. This
0014 file is designed to support limited random-access and future
0015 extendability.
0016
0017 A binary OSM file consists of a sequence of FileBlocks (please see
0018 fileformat.proto). The first fileblock contains a serialized instance
0019 of HeaderBlock, followed by a sequence of PrimitiveBlock blocks that
0020 contain the primitives.
0021
0022 Each primitiveblock is designed to be independently parsable. It
0023 contains a string table storing all strings in that block (keys and
0024 values in tags, roles in relations, usernames, etc.) as well as
0025 metadata containing the precision of coordinates or timestamps in that
0026 block.
0027
0028 A primitiveblock contains a sequence of primitive groups, each
0029 containing primitives of the same type (nodes, densenodes, ways,
0030 relations). Coordinates are stored in signed 64-bit integers. Lat&lon
0031 are measured in units <granularity> nanodegrees. The default of
0032 granularity of 100 nanodegrees corresponds to about 1cm on the ground,
0033 and a full lat or lon fits into 32 bits.
0034
0035 Converting an integer to a lattitude or longitude uses the formula:
0036 $OUT = IN * granularity / 10**9$. Many encoding schemes use delta
0037 coding when representing nodes and relations.
0038
0039 */
0040
0041 //////////////////////////////////////////////////////////////////////////
0042 //////////////////////////////////////////////////////////////////////////
0043
0044 /* Contains the file header. */
0045
0046 message HeaderBlock {
0047 optional HeaderBBox bbox = 1;
0048 /* Additional tags to aid in parsing this dataset */
0049 repeated string required_features = 4;
0050 repeated string optional_features = 5;
0051
0052 optional string writingprogram = 16;
0053 optional string source = 17; // From the bbox field.
0054
0055 /* Tags that allow continuing an Osmosis replication */
0056
0057 // replication timestamp, expressed in seconds since the epoch,
0058 // otherwise the same value as in the "timestamp=..." field
0059 // in the state.txt file used by Osmosis
0060 optional int64 osmosis_replication_timestamp = 32;
0061
0062 // replication sequence number (sequenceNumber in state.txt)
0063 optional int64 osmosis_replication_sequence_number = 33;
0064
0065 // replication base URL (from Osmosis' configuration.txt file)
0066 optional string osmosis_replication_base_url = 34;
0067 }
0068
0069
0070 /** The bounding box field in the OSM header. BBOX, as used in the OSM
0071 header. Units are always in nanodegrees -- they do not obey
0072 granularity rules. */
0073
0074 message HeaderBBox {
0075 required sint64 left = 1;
0076 required sint64 right = 2;
0077 required sint64 top = 3;
0078 required sint64 bottom = 4;
0079 }
0080
0081
0082 ///////////////////////////////////////////////////////////////////////
0083 ///////////////////////////////////////////////////////////////////////
0084
0085
0086 message PrimitiveBlock {
0087 required StringTable stringtable = 1;
0088 repeated PrimitiveGroup primitivegroup = 2;
0089
0090 // Granularity, units of nanodegrees, used to store coordinates in this block
0091 optional int32 granularity = 17 [default=100];
0092 // Offset value between the output coordinates and the granularity grid in units of nanodegrees.
0093 optional int64 lat_offset = 19 [default=0];
0094 optional int64 lon_offset = 20 [default=0];
0095
0096 // Granularity of dates, normally represented in units of milliseconds since the 1970 epoch.
0097 optional int32 date_granularity = 18 [default=1000];
0098
0099
0100 // Proposed extension:
0101 //optional BBox bbox = XX;
0102 }
0103
0104 // Group of OSMPrimitives. All primitives in a group must be the same type.
0105 message PrimitiveGroup {
0106 repeated Node nodes = 1;
0107 optional DenseNodes dense = 2;
0108 repeated Way ways = 3;
0109 repeated Relation relations = 4;
0110 repeated ChangeSet changesets = 5;
0111 }
0112
0113
0114 /** String table, contains the common strings in each block.
0115
0116 Note that we reserve index '0' as a delimiter, so the entry at that
0117 index in the table is ALWAYS blank and unused.
0118
0119 */
0120 message StringTable {
0121 repeated bytes s = 1;
0122 }
0123
0124 /* Optional metadata that may be included into each primitive. */
0125 message Info {
0126 optional int32 version = 1 [default = -1];
0127 optional int64 timestamp = 2;
0128 optional int64 changeset = 3;
0129 optional int32 uid = 4;
0130 optional uint32 user_sid = 5; // String IDs
0131
0132 // The visible flag is used to store history information. It indicates that
0133 // the current object version has been created by a delete operation on the
0134 // OSM API.
0135 // When a writer sets this flag, it MUST add a required_features tag with
0136 // value "HistoricalInformation" to the HeaderBlock.
0137 // If this flag is not available for some object it MUST be assumed to be
0138 // true if the file has the required_features tag "HistoricalInformation"
0139 // set.
0140 optional bool visible = 6;
0141 }
0142
0143 /** Optional metadata that may be included into each primitive. Special dense format used in DenseNodes. */
0144 message DenseInfo {
0145 repeated int32 version = 1 [packed = true];
0146 repeated sint64 timestamp = 2 [packed = true]; // DELTA coded
0147 repeated sint64 changeset = 3 [packed = true]; // DELTA coded
0148 repeated sint32 uid = 4 [packed = true]; // DELTA coded
0149 repeated sint32 user_sid = 5 [packed = true]; // String IDs for usernames. DELTA coded
0150
0151 // The visible flag is used to store history information. It indicates that
0152 // the current object version has been created by a delete operation on the
0153 // OSM API.
0154 // When a writer sets this flag, it MUST add a required_features tag with
0155 // value "HistoricalInformation" to the HeaderBlock.
0156 // If this flag is not available for some object it MUST be assumed to be
0157 // true if the file has the required_features tag "HistoricalInformation"
0158 // set.
0159 repeated bool visible = 6 [packed = true];
0160 }
0161
0162
0163 // THIS IS STUB DESIGN FOR CHANGESETS. NOT USED RIGHT NOW.
0164 // TODO: REMOVE THIS?
0165 message ChangeSet {
0166 required int64 id = 1;
0167 //
0168 // // Parallel arrays.
0169 // repeated uint32 keys = 2 [packed = true]; // String IDs.
0170 // repeated uint32 vals = 3 [packed = true]; // String IDs.
0171 //
0172 // optional Info info = 4;
0173
0174 // optional int64 created_at = 8;
0175 // optional int64 closetime_delta = 9;
0176 // optional bool open = 10;
0177 // optional HeaderBBox bbox = 11;
0178 }
0179
0180
0181 message Node {
0182 required sint64 id = 1;
0183 // Parallel arrays.
0184 repeated uint32 keys = 2 [packed = true]; // String IDs.
0185 repeated uint32 vals = 3 [packed = true]; // String IDs.
0186
0187 optional Info info = 4; // May be omitted in omitmeta
0188
0189 required sint64 lat = 8;
0190 required sint64 lon = 9;
0191 }
0192
0193 /* Used to densly represent a sequence of nodes that do not have any tags.
0194
0195 We represent these nodes columnwise as five columns: ID's, lats, and
0196 lons, all delta coded. When metadata is not omitted,
0197
0198 We encode keys & vals for all nodes as a single array of integers
0199 containing key-stringid and val-stringid, using a stringid of 0 as a
0200 delimiter between nodes.
0201
0202 ( (<keyid> <valid>)* '0' )*
0203 */
0204
0205 message DenseNodes {
0206 repeated sint64 id = 1 [packed = true]; // DELTA coded
0207
0208 //repeated Info info = 4;
0209 optional DenseInfo denseinfo = 5;
0210
0211 repeated sint64 lat = 8 [packed = true]; // DELTA coded
0212 repeated sint64 lon = 9 [packed = true]; // DELTA coded
0213
0214 // Special packing of keys and vals into one array. May be empty if all nodes in this block are tagless.
0215 repeated int32 keys_vals = 10 [packed = true];
0216 }
0217
0218
0219 message Way {
0220 required int64 id = 1;
0221 // Parallel arrays.
0222 repeated uint32 keys = 2 [packed = true];
0223 repeated uint32 vals = 3 [packed = true];
0224
0225 optional Info info = 4;
0226
0227 repeated sint64 refs = 8 [packed = true]; // DELTA coded
0228 }
0229
0230 message Relation {
0231 enum MemberType {
0232 NODE = 0;
0233 WAY = 1;
0234 RELATION = 2;
0235 }
0236 required int64 id = 1;
0237
0238 // Parallel arrays.
0239 repeated uint32 keys = 2 [packed = true];
0240 repeated uint32 vals = 3 [packed = true];
0241
0242 optional Info info = 4;
0243
0244 // Parallel arrays
0245 repeated int32 roles_sid = 8 [packed = true];
0246 repeated sint64 memids = 9 [packed = true]; // DELTA encoded
0247 repeated MemberType types = 10 [packed = true];
0248 }
0249