forked from district10/geobuf-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
geobuf_index.proto
38 lines (34 loc) · 1.42 KB
/
geobuf_index.proto
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
option optimize_for = LITE_RUNTIME;
message Index {
uint32 header_size = 1; // can parse Data[0:header_size] to init keys/dim/e
uint32 num_features = 2;
repeated uint64 offsets = 3 [packed = true]; // can parse Data[offsets[i]:offsets[i+1]] to get ith feature
// len(offsets) == num_features + 2, can parse data[offsets[-2]:offsets[-1]] to get feature_collection.custom_properties
// feature id?
// - feature.id
// - feature.properties.id
// - feature.properties.fid
// - feature.properties.feature_id
// related docs:
// - https://docs.mapbox.com/mapbox-gl-js/api/map/#instance-members-feature-state
// - https://github.com/mapbox/mapbox-gl-js/pull/8987
repeated string fids = 4;
repeated uint32 idxs = 5 [packed = true];
optional PackedRTree packed_rtree = 8; // spatial index
message PackedRTree {
double left = 1;
double bottom = 2;
double right = 3;
double top = 4;
uint32 num_items = 5;
uint32 num_nodes = 6;
uint32 node_size = 7;
bytes serialized = 8;
}
// Tools
// - encoding
// python3 -m pybind11_geobuf index_geobuf path/to/geobuf.pbf output/geobuf.idx
// - inspect index
// python3 -m pybind11_geobuf pbf_decode geobuf.idx
// node bin/index2json geobuf.idx # need `npm i pbf concat-stream`
}