mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Merge pull request #53 from mapbox/badproj
Add a warning when data appears to be in the wrong projection
This commit is contained in:
@@ -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 scale = (double) (1LL << (64 - 2 * (z + 8)));
|
||||||
double gap = 0;
|
double gap = 0;
|
||||||
|
|
||||||
|
long long original_features = 0;
|
||||||
|
long long unclipped_features = 0;
|
||||||
|
|
||||||
std::vector<std::vector<coalesce> > features;
|
std::vector<std::vector<coalesce> > features;
|
||||||
for (i = 0; i < nlayers; i++) {
|
for (i = 0; i < nlayers; i++) {
|
||||||
features.push_back(std::vector<coalesce>());
|
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;
|
oprogress = progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
original_features++;
|
||||||
|
|
||||||
int quick = quick_check(bbox, z, line_detail, buffer);
|
int quick = quick_check(bbox, z, line_detail, buffer);
|
||||||
if (quick == 0) {
|
if (quick == 0) {
|
||||||
continue;
|
continue;
|
||||||
@@ -442,6 +447,10 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
|
|||||||
geom = remove_noop(geom, t);
|
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 (line_detail == detail && fraction == 1) { /* only write out the next zoom once, even if we retry */
|
||||||
if (geom.size() > 0 && z + 1 <= file_maxzoom) {
|
if (geom.size() > 0 && z + 1 <= file_maxzoom) {
|
||||||
int j;
|
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;
|
long long totalsize = 0;
|
||||||
for (j = 0; j < nlayers; j++) {
|
for (j = 0; j < nlayers; j++) {
|
||||||
totalsize += features[j].size();
|
totalsize += features[j].size();
|
||||||
|
|||||||
Reference in New Issue
Block a user