mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-22 04:18:01 +00:00
Elevation in geometry is a warning, not an error.
Only complain about the first null geometry, not ever one.
This commit is contained in:
parent
40ecfc0668
commit
b068635acf
26
geojson.c
26
geojson.c
@ -138,12 +138,21 @@ void parse_geometry(int t, json_object *j, unsigned *bbox, long long *fpos, FILE
|
||||
parse_geometry(within, j->array[i], bbox, fpos, out, op, fname, source);
|
||||
}
|
||||
} else {
|
||||
if (j->length == 2 && j->array[0]->type == JSON_NUMBER && j->array[1]->type == JSON_NUMBER) {
|
||||
if (j->length >= 2 && j->array[0]->type == JSON_NUMBER && j->array[1]->type == JSON_NUMBER) {
|
||||
unsigned x, y;
|
||||
double lon = j->array[0]->number;
|
||||
double lat = j->array[1]->number;
|
||||
latlon2tile(lat, lon, 32, &x, &y);
|
||||
|
||||
if (j->length > 2) {
|
||||
static int warned = 0;
|
||||
|
||||
if (!warned) {
|
||||
fprintf(stderr, "%s:%d: ignoring dimensions beyond two\n", fname, source->line);
|
||||
warned = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (bbox != NULL) {
|
||||
if (x < bbox[0]) {
|
||||
bbox[0] = x;
|
||||
@ -360,8 +369,19 @@ void read_json(FILE *f, const char *fname, const char *layername, int maxzoom, i
|
||||
}
|
||||
|
||||
json_object *geometry_type = json_hash_get(geometry, "type");
|
||||
if (geometry_type == NULL || geometry_type->type != JSON_STRING) {
|
||||
fprintf(stderr, "%s:%d: geometry without type string\n", fname, jp->line);
|
||||
if (geometry_type == NULL) {
|
||||
static int warned = 0;
|
||||
if (!warned) {
|
||||
fprintf(stderr, "%s:%d: null geometry (additional not reported)\n", fname, jp->line);
|
||||
warned = 1;
|
||||
}
|
||||
|
||||
json_free(j);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (geometry_type->type != JSON_STRING) {
|
||||
fprintf(stderr, "%s:%d: geometry without type\n", fname, jp->line);
|
||||
json_free(j);
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user