mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-04-04 09:39:05 +00:00
Merge pull request #352 from mapbox/warn-id
Only warn once about non-numeric/non-integer/negative feature IDs
This commit is contained in:
commit
c67b5f33bd
25
geojson.cpp
25
geojson.cpp
@ -241,17 +241,32 @@ int serialize_geometry(json_object *geometry, json_object *properties, json_obje
|
||||
id_value = strtoull(id->string, &err, 10);
|
||||
|
||||
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 {
|
||||
has_id = true;
|
||||
}
|
||||
} 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 {
|
||||
char *s = json_stringify(id);
|
||||
fprintf(stderr, "Warning: Can't represent non-numeric feature ID %s\n", s);
|
||||
free(s); // stringify
|
||||
static bool warned_nan = false;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user