mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-04-06 02:26:39 +00:00
Print details of the feature when Wagyu throws an exception
This commit is contained in:
parent
b550c7b4a6
commit
370252731a
@ -268,8 +268,11 @@ drawvec clean_or_clip_poly(drawvec &geom, int z, int buffer, bool clip) {
|
||||
}
|
||||
|
||||
mapbox::geometry::multi_polygon<long long> result;
|
||||
#if 0
|
||||
try {
|
||||
#endif
|
||||
wagyu.execute(mapbox::geometry::wagyu::clip_type_union, result, mapbox::geometry::wagyu::fill_type_positive, mapbox::geometry::wagyu::fill_type_positive);
|
||||
#if 0
|
||||
} catch (std::runtime_error e) {
|
||||
FILE *f = fopen("/tmp/wagyu.log", "w");
|
||||
fprintf(f, "%s\n", e.what());
|
||||
@ -318,6 +321,7 @@ drawvec clean_or_clip_poly(drawvec &geom, int z, int buffer, bool clip) {
|
||||
fprintf(stderr, "Internal error: Polygon cleaning failed. Log in /tmp/wagyu.log\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
drawvec ret;
|
||||
decode_clipped(result, ret);
|
||||
|
30
tile.cpp
30
tile.cpp
@ -7,6 +7,7 @@
|
||||
#include <string>
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
#include <exception>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
@ -375,6 +376,8 @@ struct partial {
|
||||
long long extent = 0;
|
||||
long long clustered = 0;
|
||||
std::set<std::string> need_tilestats;
|
||||
char *stringpool;
|
||||
long long *pool_off;
|
||||
};
|
||||
|
||||
struct partial_arg {
|
||||
@ -494,7 +497,30 @@ void *partial_feature_worker(void *v) {
|
||||
// Give Clipper a chance to try to fix it.
|
||||
for (size_t g = 0; g < geoms.size(); g++) {
|
||||
drawvec before = geoms[g];
|
||||
geoms[g] = clean_or_clip_poly(geoms[g], 0, 0, false);
|
||||
try {
|
||||
geoms[g] = clean_or_clip_poly(geoms[g], 0, 0, false);
|
||||
} catch (const std::exception& e) {
|
||||
struct partial *p = &((*partials)[i]);
|
||||
|
||||
fprintf(stderr, "Failing feature:\n");
|
||||
|
||||
if (p->has_id) {
|
||||
fprintf(stderr, "id %lld\n", p->id);
|
||||
}
|
||||
|
||||
for (size_t ii = 0; ii < p->full_keys.size(); ii++) {
|
||||
fprintf(stderr, "%s: %s\n", p->full_keys[ii].c_str(), p->full_values[ii].s.c_str());
|
||||
}
|
||||
for (size_t ii = 0; ii < p->keys.size(); ii++) {
|
||||
fprintf(stderr, "%s: %s\n",
|
||||
p->stringpool + p->pool_off[p->segment] + p->keys[ii] + 1,
|
||||
p->stringpool + p->pool_off[p->segment] + p->values[ii] + 1);
|
||||
}
|
||||
|
||||
fflush(stderr);
|
||||
throw(e);
|
||||
}
|
||||
|
||||
if (additional[A_DEBUG_POLYGON]) {
|
||||
check_polygon(geoms[g]);
|
||||
}
|
||||
@ -1992,6 +2018,8 @@ long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *meta
|
||||
p.renamed = -1;
|
||||
p.extent = sf.extent;
|
||||
p.clustered = 0;
|
||||
p.stringpool = stringpool;
|
||||
p.pool_off = pool_off;
|
||||
partials.push_back(p);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user