bbox_tile_server/cli.rs
1use clap::{Args, Parser};
2
3#[derive(Debug, Parser)]
4#[command(name = "bbox-tile-server")]
5#[command(about = "BBOX tile server", long_about = None)]
6pub struct Cli {
7 #[command(subcommand)]
8 pub command: Commands,
9}
10
11/* t-rex serve:
12OPTIONS:
13 --cache <DIR> Use tile cache in DIR
14 --clip <true|false> Clip geometries
15 --datasource <FILE_OR_GDAL_DS> GDAL datasource specification
16 --dbconn <SPEC> PostGIS connection postgresql://USER@HOST/DBNAME
17 --detect-geometry-types <true|false> Detect geometry types when undefined
18 --no-transform <true|false> Do not transform to grid SRS
19 --openbrowser <true|false> Open backend URL in browser
20 --qgs <FILE> QGIS project file
21 --simplify <true|false> Simplify geometries
22*/
23
24#[derive(Parser, Debug)]
25pub enum Commands {
26 /// Seed tiles
27 #[command(arg_required_else_help = true)]
28 Seed(SeedArgs),
29 /// Upload tiles
30 #[command(arg_required_else_help = true)]
31 Upload(UploadArgs),
32}
33
34#[derive(Debug, Args)]
35pub struct SeedArgs {
36 /// tile set name
37 #[arg(long)]
38 pub tileset: String,
39 /// Minimum zoom level
40 #[arg(long)]
41 pub minzoom: Option<u8>,
42 /// Maximum zoom level
43 #[arg(long)]
44 pub maxzoom: Option<u8>,
45 /// tile matrix set id
46 #[arg(long)]
47 pub tms: Option<String>,
48 /// Extent minx,miny,maxx,maxy (in grid reference system)
49 #[arg(long)]
50 pub extent: Option<String>,
51 /// Base directory for file store
52 #[arg(long, group = "store")]
53 pub tile_path: Option<String>,
54 /// S3 path to upload to (e.g. s3://tiles)
55 #[arg(long, group = "store")]
56 pub s3_path: Option<String>,
57 /// MBTiles path to store tiles
58 #[arg(long, group = "store")]
59 pub mb_path: Option<String>,
60 /// PMTiles path to store tiles
61 #[arg(long, group = "store")]
62 pub pm_path: Option<String>,
63 /// No tile store (for read benchmarks)
64 #[arg(long, group = "store")]
65 pub no_store: bool,
66 /// Number of threads to use, defaults to number of logical cores
67 #[arg(short, long)]
68 pub threads: Option<usize>,
69 /// Size of tasks queue for parallel processing
70 #[arg(long)]
71 pub tasks: Option<usize>,
72 /// Overwrite previously cached tiles
73 #[arg(long)]
74 pub overwrite: Option<bool>,
75 /// Read tiles from file or URL
76 pub file_or_url: Option<String>,
77}
78
79#[derive(Debug, Args)]
80pub struct UploadArgs {
81 /// Base directory of input files
82 #[arg(short, long)]
83 pub srcdir: std::path::PathBuf,
84 /// S3 path to upload to (e.g. s3://tiles)
85 #[arg(long, group = "output_s3")]
86 pub s3_path: String,
87 /// Parallelzation mode
88 #[arg(short, long, value_enum, default_value("tasks"))]
89 pub mode: Mode,
90 /// Number of threads to use, defaults to number of logical cores
91 #[arg(short, long)]
92 pub threads: Option<usize>,
93 /// Size of tasks queue for parallel processing
94 #[arg(long)]
95 pub tasks: Option<usize>,
96}
97
98#[derive(clap::ValueEnum, Clone, Debug)]
99pub enum Mode {
100 Sequential,
101 Tasks,
102 Channels,
103}
104
105/* t-rex generate:
106 --config=<FILE> 'Load from custom config file'
107 --loglevel=[error|warn|info|debug|trace] 'Log level (Default: info)'
108 --tileset=[NAME] 'Tileset name'
109 --minzoom=[LEVEL] 'Minimum zoom level'
110 --maxzoom=[LEVEL] 'Maximum zoom level'
111 --extent=[minx,miny,maxx,maxy[,srid]] 'Extent of tiles'
112 --nodes=[NUM] 'Number of generator nodes'
113 --nodeno=[NUM] 'Number of this nodes (0 <= n < nodes)'
114 --progress=[true|false] 'Show progress bar'
115 --overwrite=[false|true] 'Overwrite previously cached tiles'")
116*/