Skip to content

Instantly share code, notes, and snippets.

@mourner
Last active August 8, 2017 04:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mourner/8754884156f3f34d8ee9 to your computer and use it in GitHub Desktop.
Save mourner/8754884156f3f34d8ee9 to your computer and use it in GitHub Desktop.
// each top-level message in a file is tag-prefixed (like fields) to differentiate between types
message Data {
oneof data_type {
fixed32 block_size = 1; // byte length of the following block (metadata + features/geometries)
Metadata metadata = 2;
Collection feature_collection = 3;
Collection geometry_collection = 4;
Collection collection_end = 5;
Feature feature = 6;
Geometry point = 7;
Geometry linestring = 8;
Geometry polygon = 9;
Geometry multipoint = 10;
Geometry multilinestring = 11;
Geometry multipolygon = 12;
}
}
message Metadata {
uint32 version = 1; // geobuf version
uint32 dimensions = 2; // max coordinate dimensions
uint32 precision = 3; // number of digits after decimal point for coordinates
repeated string keys = 4; // array of unique keys of a block
repeated Value values = 5; // array of unique values of a block
}
message Collection {
repeated uint32 custom_properties = 15 [packed = true]; // pairs of key/value indexes for arbitrary properties
}
message Feature {
oneof id_type {
string id = 1;
sint64 int_id = 2;
}
repeated uint32 properties = 14 [packed = true]; // pairs of key/value indexes for feature properties
repeated uint32 custom_properties = 15 [packed = true];
}
message Geometry {
repeated uint32 lengths = 1 [packed = true]; // coordinate structure (lengths of parts etc.)
repeated sint64 coords = 2 [packed = true]; // coordinates as delta-encoded integers
repeated uint32 custom_properties = 15 [packed = true];
}
message Value {
oneof value_type {
string string_value = 1;
double double_value = 2;
uint64 unsigned_int_value = 3;
uint64 negative_int_value = 4;
bool bool_value = 5;
string json_value = 6;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment