felt/tippecanoe

Is there a way to dump the bytes being read by 'json_pull' to STDERR on error?

Opened this issue · 0 comments

Apologies, I am not a C-person so I am sort of feeling my way around here. I am trying to determine how best to handle errors like this:

standard input:4099: Found unexpected character:

When tippecanoe is invoked like this:

wof-tippecanoe-features \
    -as-spr \
    -require-polygons \
    -writer-uri 'constant://?val=jsonl://?writer=stdout://' \
    -iterator-uri 'org:///usr/local/data whosonfirst-data://?prefix=whosonfirst-data-admin-' \

 | tippecanoe -Q -P -z 12 -pf -pk \
    -n whosonfirst \
    -t /usr/local/data \
    -o /usr/local/data/whosonfirst-point-in-polygon-z12.pmtiles

Which is basically saying: Fetch every "whosonfirst-data-admin-*" repository and pipe each record to tippecanoe as a line-separated JSON stream. So the problem I am having is there's no easy way to determine which file in which repo is triggering the "unexpected character" errors. Poking around the code it appears that error in question is being triggered here:

json_object *j = json_read(jp);
if (j == NULL) {
if (jp->error != NULL) {
fprintf(stderr, "%s:%d: %s: ", jfa->fname.c_str(), jp->line, jp->error);
if (jp->root != NULL) {
json_context(jp->root);
} else {
fprintf(stderr, "\n");
}
}
json_free(jp->root);
break;

Is there already an existing flag somewhere to, optionally, dump the body of jp (or jfa?) to STDERR when an error is encountered? It doesn't look like it but I figured I would ask.

Thanks,