1 /*****************************************************************************
2 
3   Example program for vtzero library.
4 
5   vtzero-stats - Output some stats on layers
6 
7 *****************************************************************************/
8 
9 #include "utils.hpp"
10 
11 #include <vtzero/vector_tile.hpp>
12 
13 #include <iostream>
14 #include <stdexcept>
15 #include <string>
16 
main(int argc,char * argv[])17 int main(int argc, char* argv[]) {
18     if (argc != 2) {
19         std::cerr << "Usage: " << argv[0] << " TILE\n";
20         return 1;
21     }
22 
23     std::string input_file{argv[1]};
24     const auto data = read_file(input_file);
25 
26     vtzero::vector_tile tile{data};
27 
28     while (const auto layer = tile.next_layer()) {
29         std::cout.write(layer.name().data(), static_cast<std::streamsize>(layer.name().size()));
30         std::cout << ' '
31                   << layer.num_features() << ' '
32                   << layer.key_table().size() << ' '
33                   << layer.value_table().size() << '\n';
34     }
35 }
36 
37