mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 01:45:41 +02:00
Only warn once about non-numeric/non-integer/negative feature IDs
This commit is contained in:
+20
-5
@@ -241,17 +241,32 @@ int serialize_geometry(json_object *geometry, json_object *properties, json_obje
|
|||||||
id_value = strtoull(id->string, &err, 10);
|
id_value = strtoull(id->string, &err, 10);
|
||||||
|
|
||||||
if (err != NULL && *err != '\0') {
|
if (err != NULL && *err != '\0') {
|
||||||
fprintf(stderr, "Warning: Can't represent non-integer feature ID %s\n", id->string);
|
static bool warned_frac = false;
|
||||||
|
|
||||||
|
if (!warned_frac) {
|
||||||
|
fprintf(stderr, "Warning: Can't represent non-integer feature ID %s\n", id->string);
|
||||||
|
warned_frac = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
has_id = true;
|
has_id = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Warning: Can't represent negative feature ID %s\n", id->string);
|
static bool warned_neg = false;
|
||||||
|
|
||||||
|
if (!warned_neg) {
|
||||||
|
fprintf(stderr, "Warning: Can't represent negative feature ID %s\n", id->string);
|
||||||
|
warned_neg = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char *s = json_stringify(id);
|
static bool warned_nan = false;
|
||||||
fprintf(stderr, "Warning: Can't represent non-numeric feature ID %s\n", s);
|
|
||||||
free(s); // stringify
|
if (!warned_nan) {
|
||||||
|
char *s = json_stringify(id);
|
||||||
|
fprintf(stderr, "Warning: Can't represent non-numeric feature ID %s\n", s);
|
||||||
|
free(s); // stringify
|
||||||
|
warned_nan = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user