From 38a41f4df8ebd13702f61f8a7f8e6d2dd3fb7258 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 9 Dec 2014 11:03:44 -0500 Subject: [PATCH 1/4] Installation instructions --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index ec998604..a308df8d 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,13 @@ tippecanoe 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 ----- From 40ecfc0668769310a0ccff19fcbccc4d456475ac Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Tue, 9 Dec 2014 15:17:20 -0800 Subject: [PATCH 2/4] Add missing newline to error message. --- geojson.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geojson.c b/geojson.c index eaa64e04..cfac21be 100644 --- a/geojson.c +++ b/geojson.c @@ -163,7 +163,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, y, fpos, fname, source); } else { - fprintf(stderr, "%s:%d: malformed point", fname, source->line); + fprintf(stderr, "%s:%d: malformed point\n", fname, source->line); } } From b068635acf19714d3647914f23c9742e6f57cc8c Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Tue, 9 Dec 2014 15:23:22 -0800 Subject: [PATCH 3/4] Elevation in geometry is a warning, not an error. Only complain about the first null geometry, not ever one. --- geojson.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/geojson.c b/geojson.c index cfac21be..70cd547f 100644 --- a/geojson.c +++ b/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; } From a867646dfd9b4b0493c15db222fcda44d753fa75 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Wed, 3 Dec 2014 16:30:35 -0800 Subject: [PATCH 4/4] Don't introduce bogus geometries in clipped-away features. --- geometry.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/geometry.cc b/geometry.cc index daecdceb..14aa0799 100644 --- a/geometry.cc +++ b/geometry.cc @@ -548,6 +548,10 @@ drawvec simplify_lines(drawvec &geom, int z, int detail) { drawvec reorder_lines(drawvec &geom) { // Only reorder simple linestrings with a single moveto + if (geom.size() == 0) { + return geom; + } + unsigned i; for (i = 0; i < geom.size(); i++) { if (geom[i].op == VT_MOVETO) {