mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-24 10:44:51 +00:00
Merge branch 'master' into topdown
This commit is contained in:
commit
34a6422c42
@ -3,6 +3,13 @@ tippecanoe
|
|||||||
|
|
||||||
Build vector tilesets from large collections of GeoJSON features.
|
Build vector tilesets from large collections of GeoJSON features.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
The easiest way to install tippecanoe on OSX is with [Homebrew](http://brew.sh/):
|
||||||
|
|
||||||
|
brew install tippecanoe
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
28
geojson.c
28
geojson.c
@ -143,12 +143,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);
|
parse_geometry(within, j->array[i], bbox, fpos, out, op, fname, source);
|
||||||
}
|
}
|
||||||
} else {
|
} 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;
|
unsigned x, y;
|
||||||
double lon = j->array[0]->number;
|
double lon = j->array[0]->number;
|
||||||
double lat = j->array[1]->number;
|
double lat = j->array[1]->number;
|
||||||
latlon2tile(lat, lon, 32, &x, &y);
|
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 (bbox != NULL) {
|
||||||
if (x < bbox[0]) {
|
if (x < bbox[0]) {
|
||||||
bbox[0] = x;
|
bbox[0] = x;
|
||||||
@ -168,7 +177,7 @@ void parse_geometry(int t, json_object *j, unsigned *bbox, long long *fpos, FILE
|
|||||||
serialize_uint(out, x, fpos, fname, source);
|
serialize_uint(out, x, fpos, fname, source);
|
||||||
serialize_uint(out, y, fpos, fname, source);
|
serialize_uint(out, y, fpos, fname, source);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "%s:%d: malformed point", fname, source->line);
|
fprintf(stderr, "%s:%d: malformed point\n", fname, source->line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,8 +435,19 @@ void read_json(FILE *f, const char *fname, const char *layername, int maxzoom, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
json_object *geometry_type = json_hash_get(geometry, "type");
|
json_object *geometry_type = json_hash_get(geometry, "type");
|
||||||
if (geometry_type == NULL || geometry_type->type != JSON_STRING) {
|
if (geometry_type == NULL) {
|
||||||
fprintf(stderr, "%s:%d: geometry without type string\n", fname, jp->line);
|
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);
|
json_free(j);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user