mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-23 18:40:17 +00:00
Add a warning when data appears to be in the wrong projection
This commit is contained in:
parent
1a95504390
commit
263ae94e75
14
tile.cc
14
tile.cc
@ -387,6 +387,9 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
|
||||
double scale = (double) (1LL << (64 - 2 * (z + 8)));
|
||||
double gap = 0;
|
||||
|
||||
long long original_features = 0;
|
||||
long long unclipped_features = 0;
|
||||
|
||||
std::vector<std::vector<coalesce> > features;
|
||||
for (i = 0; i < nlayers; i++) {
|
||||
features.push_back(std::vector<coalesce>());
|
||||
@ -423,6 +426,8 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
|
||||
oprogress = progress;
|
||||
}
|
||||
|
||||
original_features++;
|
||||
|
||||
int quick = quick_check(bbox, z, line_detail, buffer);
|
||||
if (quick == 0) {
|
||||
continue;
|
||||
@ -442,6 +447,10 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
|
||||
geom = remove_noop(geom, t);
|
||||
}
|
||||
|
||||
if (geom.size() > 0) {
|
||||
unclipped_features++;
|
||||
}
|
||||
|
||||
if (line_detail == detail && fraction == 1) { /* only write out the next zoom once, even if we retry */
|
||||
if (geom.size() > 0 && z + 1 <= file_maxzoom) {
|
||||
int j;
|
||||
@ -654,6 +663,11 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
|
||||
}
|
||||
}
|
||||
|
||||
if (z == 0 && unclipped_features < original_features / 2) {
|
||||
fprintf(stderr, "\n\nMore than half the features were clipped away at zoom level 0.\n");
|
||||
fprintf(stderr, "Is your data in the wrong projection? (Not WGS84/EPSG:4326)\n");
|
||||
}
|
||||
|
||||
long long totalsize = 0;
|
||||
for (j = 0; j < nlayers; j++) {
|
||||
totalsize += features[j].size();
|
||||
|
Loading…
x
Reference in New Issue
Block a user