forked from mapbox/tippecanoe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dirtiles.hpp
49 lines (39 loc) · 1003 Bytes
/
dirtiles.hpp
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
39
40
41
42
43
44
45
46
47
48
49
#include <string>
#include <vector>
#include <sys/stat.h>
#ifndef DIRTILES_HPP
#define DIRTILES_HPP
void dir_write_tile(const char *outdir, int z, int tx, int ty, std::string const &pbf);
void check_dir(const char *d, char **argv, bool force, bool forcetable);
struct zxy {
long long z;
long long x;
long long y;
std::string extension = ".pbf";
zxy(int _z, int _x, int _y)
: z(_z), x(_x), y(_y) {
}
bool operator<(const zxy &other) const {
if (z < other.z) {
return true;
}
if (z == other.z) {
if (x < other.x) {
return true;
}
if (x == other.x) {
if (y > other.y) {
return true; // reversed for TMS
}
}
}
return false;
}
std::string path() {
return std::to_string(z) + "/" + std::to_string(x) + "/" + std::to_string(y) + extension;
}
};
std::vector<zxy> enumerate_dirtiles(const char *fname, int minzoom, int maxzoom);
sqlite3 *dirmeta2tmp(const char *fname);
std::string dir_read_tile(std::string pbfPath, struct zxy tile);
#endif