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