mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-06-25 01:59:11 +00:00
Compare commits
4 Commits
master
...
test-paral
Author | SHA1 | Date | |
---|---|---|---|
4beec5198c | |||
934d23f89c | |||
de4de2cb98 | |||
ff9a47c03e |
@ -205,10 +205,11 @@ resolution is obtained than by using a smaller _maxzoom_ or _detail_.
|
||||
* `-pk` or `--no-tile-size-limit`: Don't limit tiles to 500K bytes
|
||||
* `-pC` or `--no-tile-compression`: Don't compress the PBF vector tile data.
|
||||
|
||||
### Temporary storage
|
||||
### System parameters
|
||||
|
||||
* `-t` _directory_ or `--temporary-directory=`_directory_: Put the temporary files in _directory_.
|
||||
If you don't specify, it will use `/tmp`.
|
||||
* `-j` _cpus_ or `--cpus=`_cpus_: Use the specified number of CPUs for parallel processing.
|
||||
|
||||
### Progress indicator
|
||||
|
||||
@ -219,7 +220,7 @@ Environment
|
||||
-----------
|
||||
|
||||
Tippecanoe ordinarily uses as many parallel threads as the operating system claims that CPUs are available.
|
||||
You can override this number by setting the `TIPPECANOE_MAX_THREADS` environmental variable.
|
||||
You can override this number by setting the `TIPPECANOE_MAX_THREADS` environmental variable or using the `--cpus` option.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
@ -493,7 +493,7 @@ int serialize_geometry(json_object *geometry, json_object *properties, json_obje
|
||||
sf.feature_minzoom = 0; // Will be filled in during index merging
|
||||
sf.extent = (long long) extent;
|
||||
|
||||
if (prevent[P_INPUT_ORDER]) {
|
||||
if (prevent[P_INPUT_ORDER] || additional[A_TAG_SEQUENCE]) {
|
||||
sf.seq = *layer_seq;
|
||||
} else {
|
||||
sf.seq = 0;
|
||||
|
41
main.cpp
41
main.cpp
@ -118,10 +118,12 @@ void checkdisk(struct reader *r, int nreader) {
|
||||
}
|
||||
};
|
||||
|
||||
void init_cpus() {
|
||||
void init_cpus(size_t cpus) {
|
||||
const char *TIPPECANOE_MAX_THREADS = getenv("TIPPECANOE_MAX_THREADS");
|
||||
|
||||
if (TIPPECANOE_MAX_THREADS != NULL) {
|
||||
if (cpus > 0) {
|
||||
CPUS = cpus;
|
||||
} else if (TIPPECANOE_MAX_THREADS != NULL) {
|
||||
CPUS = atoi(TIPPECANOE_MAX_THREADS);
|
||||
} else {
|
||||
CPUS = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
@ -1204,7 +1206,7 @@ int read_input(std::vector<source> &sources, char *fname, int &maxzoom, int minz
|
||||
|
||||
int read_parallel_this = read_parallel ? '\n' : 0;
|
||||
|
||||
if (1) {
|
||||
if (!prevent[P_MEMORY_MAP]) {
|
||||
if (fstat(fd, &st) == 0) {
|
||||
off = lseek(fd, 0, SEEK_CUR);
|
||||
if (off >= 0) {
|
||||
@ -1280,7 +1282,7 @@ int read_input(std::vector<source> &sources, char *fname, int &maxzoom, int minz
|
||||
unlink(readname);
|
||||
|
||||
volatile int is_parsing = 0;
|
||||
long long ahead = 0;
|
||||
size_t ahead = 0;
|
||||
long long initial_offset = overall_offset;
|
||||
pthread_t parallel_parser;
|
||||
bool parser_created = false;
|
||||
@ -1289,19 +1291,28 @@ int read_input(std::vector<source> &sources, char *fname, int &maxzoom, int minz
|
||||
#define PARSE_MIN 10000000
|
||||
#define PARSE_MAX (1LL * 1024 * 1024 * 1024)
|
||||
|
||||
char buf[READ_BUF];
|
||||
size_t parse_min = PARSE_MIN;
|
||||
size_t read_buf = READ_BUF;
|
||||
size_t parse_max = PARSE_MAX;
|
||||
if (prevent[P_MEMORY_MAP]) {
|
||||
parse_min = 2000;
|
||||
read_buf = 5;
|
||||
parse_max = 5;
|
||||
}
|
||||
|
||||
char buf[read_buf];
|
||||
int n;
|
||||
|
||||
while ((n = fread(buf, sizeof(char), READ_BUF, fp)) > 0) {
|
||||
while ((n = fread(buf, sizeof(char), read_buf, fp)) > 0) {
|
||||
fwrite_check(buf, sizeof(char), n, readfp, reading.c_str());
|
||||
ahead += n;
|
||||
|
||||
if (buf[n - 1] == read_parallel_this && ahead > PARSE_MIN) {
|
||||
if (buf[n - 1] == read_parallel_this && ahead > parse_min) {
|
||||
// Don't let the streaming reader get too far ahead of the parsers.
|
||||
// If the buffered input gets huge, even if the parsers are still running,
|
||||
// wait for the parser thread instead of continuing to stream input.
|
||||
|
||||
if (is_parsing == 0 || ahead >= PARSE_MAX) {
|
||||
if (is_parsing == 0 || ahead >= parse_max) {
|
||||
if (parser_created) {
|
||||
if (pthread_join(parallel_parser, NULL) != 0) {
|
||||
perror("pthread_join 1088");
|
||||
@ -1988,8 +1999,6 @@ int main(int argc, char **argv) {
|
||||
mtrace();
|
||||
#endif
|
||||
|
||||
init_cpus();
|
||||
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
int i;
|
||||
@ -2013,6 +2022,7 @@ int main(int argc, char **argv) {
|
||||
const char *attribution = NULL;
|
||||
std::vector<source> sources;
|
||||
bool guess_maxzoom = false;
|
||||
size_t cpus = 0;
|
||||
|
||||
std::set<std::string> exclude, include;
|
||||
std::map<std::string, int> attribute_types;
|
||||
@ -2111,8 +2121,9 @@ int main(int argc, char **argv) {
|
||||
{"no-tile-size-limit", no_argument, &prevent[P_KILOBYTE_LIMIT], 1},
|
||||
{"no-tile-compression", no_argument, &prevent[P_TILE_COMPRESSION], 1},
|
||||
|
||||
{"Temporary storage", 0, 0, 0},
|
||||
{"System parameters", 0, 0, 0},
|
||||
{"temporary-directory", required_argument, 0, 't'},
|
||||
{"cpus", required_argument, 0, 'j'},
|
||||
|
||||
{"Progress indicator", 0, 0, 0},
|
||||
{"quiet", no_argument, 0, 'q'},
|
||||
@ -2124,6 +2135,8 @@ int main(int argc, char **argv) {
|
||||
{"check-polygons", no_argument, &additional[A_DEBUG_POLYGON], 1},
|
||||
{"no-polygon-splitting", no_argument, &prevent[P_POLYGON_SPLIT], 1},
|
||||
{"prefer-radix-sort", no_argument, &additional[A_PREFER_RADIX_SORT], 1},
|
||||
{"tag-sequence", no_argument, &additional[A_TAG_SEQUENCE], 1},
|
||||
{"no-memory-mapping", no_argument, &prevent[P_MEMORY_MAP], 1},
|
||||
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
@ -2307,6 +2320,10 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
cpus = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
gamma = atof(optarg);
|
||||
break;
|
||||
@ -2401,6 +2418,8 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
init_cpus(cpus);
|
||||
|
||||
files_open_at_start = open("/dev/null", O_RDONLY);
|
||||
close(files_open_at_start);
|
||||
|
||||
|
@ -250,11 +250,13 @@ the line or polygon within one tile unit of its proper location. You can probabl
|
||||
.IP \(bu 2
|
||||
\fB\fC\-pC\fR or \fB\fC\-\-no\-tile\-compression\fR: Don't compress the PBF vector tile data.
|
||||
.RE
|
||||
.SS Temporary storage
|
||||
.SS System parameters
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-t\fR \fIdirectory\fP or \fB\fC\-\-temporary\-directory=\fR\fIdirectory\fP: Put the temporary files in \fIdirectory\fP\&.
|
||||
If you don't specify, it will use \fB\fC/tmp\fR\&.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-j\fR \fIcpus\fP or \fB\fC\-\-cpus=\fR\fIcpus\fP: Use the specified number of CPUs for parallel processing.
|
||||
.RE
|
||||
.SS Progress indicator
|
||||
.RS
|
||||
@ -266,7 +268,7 @@ If you don't specify, it will use \fB\fC/tmp\fR\&.
|
||||
.SH Environment
|
||||
.PP
|
||||
Tippecanoe ordinarily uses as many parallel threads as the operating system claims that CPUs are available.
|
||||
You can override this number by setting the \fB\fCTIPPECANOE_MAX_THREADS\fR environmental variable.
|
||||
You can override this number by setting the \fB\fCTIPPECANOE_MAX_THREADS\fR environmental variable or using the \fB\fC\-\-cpus\fR option.
|
||||
.SH Example
|
||||
.PP
|
||||
.RS
|
||||
|
@ -14,6 +14,7 @@
|
||||
#define A_DROP_SMALLEST_AS_NEEDED ((int) 'n')
|
||||
#define A_GRID_LOW_ZOOMS ((int) 'L')
|
||||
#define A_DETECT_WRAPAROUND ((int) 'w')
|
||||
#define A_TAG_SEQUENCE ((int) 'S')
|
||||
|
||||
#define P_SIMPLIFY ((int) 's')
|
||||
#define P_SIMPLIFY_LOW ((int) 'S')
|
||||
@ -26,6 +27,7 @@
|
||||
#define P_DUPLICATION ((int) 'D')
|
||||
#define P_TINY_POLYGON_REDUCTION ((int) 't')
|
||||
#define P_TILE_COMPRESSION ((int) 'C')
|
||||
#define P_MEMORY_MAP ((int) 'M')
|
||||
|
||||
extern int prevent[256];
|
||||
extern int additional[256];
|
||||
|
File diff suppressed because one or more lines are too long
370
tests/ne_110m_admin_0_countries/out/-z0_-aS_-pi_-j4.json
Normal file
370
tests/ne_110m_admin_0_countries/out/-z0_-aS_-pi_-j4.json
Normal file
File diff suppressed because one or more lines are too long
370
tests/ne_110m_admin_0_countries/out/-z0_-aS_-pi_-j4_-P.json
Normal file
370
tests/ne_110m_admin_0_countries/out/-z0_-aS_-pi_-j4_-P.json
Normal file
File diff suppressed because one or more lines are too long
370
tests/ne_110m_admin_0_countries/out/-z0_-aS_-pi_-j4_-pM.json
Normal file
370
tests/ne_110m_admin_0_countries/out/-z0_-aS_-pi_-j4_-pM.json
Normal file
File diff suppressed because one or more lines are too long
370
tests/ne_110m_admin_0_countries/out/-z0_-aS_-pi_-j4_-pM_-P.json
Normal file
370
tests/ne_110m_admin_0_countries/out/-z0_-aS_-pi_-j4_-pM_-P.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
7
tile.cpp
7
tile.cpp
@ -1730,6 +1730,13 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
||||
|
||||
decode_meta(layer_features[x].m, layer_features[x].keys, layer_features[x].values, layer_features[x].stringpool, layer, feature);
|
||||
|
||||
if (additional[A_TAG_SEQUENCE]) {
|
||||
mvt_value v;
|
||||
v.type = mvt_sint;
|
||||
v.numeric_value.sint_value = layer_features[x].original_seq;
|
||||
layer.tag(feature, "tippecanoe_sequence", v);
|
||||
}
|
||||
|
||||
if (additional[A_CALCULATE_FEATURE_DENSITY]) {
|
||||
int glow = 255;
|
||||
if (layer_features[x].spacing > 0) {
|
||||
|
Reference in New Issue
Block a user