mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 09:55:41 +02:00
Add a progress indicator. Remember to run the optimizer.
This commit is contained in:
@@ -6,11 +6,13 @@ install: jsonpull.h libjsonpull.a
|
|||||||
cp jsonpull.h $(PREFIX)/include/jsonpull.h
|
cp jsonpull.h $(PREFIX)/include/jsonpull.h
|
||||||
cp libjsonpull.a $(PREFIX)/lib/libjsonpull.a
|
cp libjsonpull.a $(PREFIX)/lib/libjsonpull.a
|
||||||
|
|
||||||
|
PG=
|
||||||
|
|
||||||
jsoncat: jsoncat.o jsonpull.o
|
jsoncat: jsoncat.o jsonpull.o
|
||||||
cc -g -Wall -o $@ $^
|
cc $(PG) -g -Wall -o $@ $^
|
||||||
|
|
||||||
geojson: geojson.o jsonpull.o
|
geojson: geojson.o jsonpull.o
|
||||||
cc -g -Wall -o $@ $^ -lm
|
cc $(PG) -O3 -g -Wall -o $@ $^ -lm
|
||||||
|
|
||||||
jsoncat.o jsonpull.o: jsonpull.h
|
jsoncat.o jsonpull.o: jsonpull.h
|
||||||
|
|
||||||
@@ -19,4 +21,4 @@ libjsonpull.a: jsonpull.o
|
|||||||
ranlib $@
|
ranlib $@
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
cc -g -Wall -c $<
|
cc $(PG) -O3 -g -Wall -c $<
|
||||||
|
|||||||
@@ -395,8 +395,6 @@ void check(struct index *ix, long long n, char *metabase, unsigned *file_bbox) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void read_json(FILE *f) {
|
void read_json(FILE *f) {
|
||||||
json_pull *jp = json_begin_file(f);
|
|
||||||
|
|
||||||
char metaname[] = "/tmp/meta.XXXXXXXX";
|
char metaname[] = "/tmp/meta.XXXXXXXX";
|
||||||
char indexname[] = "/tmp/index.XXXXXXXX";
|
char indexname[] = "/tmp/index.XXXXXXXX";
|
||||||
|
|
||||||
@@ -412,6 +410,9 @@ void read_json(FILE *f) {
|
|||||||
|
|
||||||
unsigned file_bbox[] = { UINT_MAX, UINT_MAX, 0, 0 };
|
unsigned file_bbox[] = { UINT_MAX, UINT_MAX, 0, 0 };
|
||||||
|
|
||||||
|
json_pull *jp = json_begin_file(f);
|
||||||
|
long long seq = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
json_object *j = json_read(jp);
|
json_object *j = json_read(jp);
|
||||||
if (j == NULL) {
|
if (j == NULL) {
|
||||||
@@ -526,6 +527,11 @@ void read_json(FILE *f) {
|
|||||||
ix.index = encode_bbox(bbox[0], bbox[1], bbox[2], bbox[3], 0);
|
ix.index = encode_bbox(bbox[0], bbox[1], bbox[2], bbox[3], 0);
|
||||||
ix.fpos = start;
|
ix.fpos = start;
|
||||||
fwrite_check(&ix, sizeof(struct index), 1, indexfile);
|
fwrite_check(&ix, sizeof(struct index), 1, indexfile);
|
||||||
|
|
||||||
|
if (seq % 100000 == 0) {
|
||||||
|
fprintf(stderr, "Read %.1f million features\r", seq / 1000000.0);
|
||||||
|
}
|
||||||
|
seq++;
|
||||||
}
|
}
|
||||||
|
|
||||||
next_feature:
|
next_feature:
|
||||||
|
|||||||
Reference in New Issue
Block a user