mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Fix clipping bug when the clip region doesn't intersect the tile (#312)
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
# 2.73.0
|
||||
|
||||
* Correctly clip features down to nothing when the clip region doesn't intersect the tile at all
|
||||
|
||||
# 2.72.0
|
||||
|
||||
* Add --clip-polygon-file and --feature-filter-file options to tippecanoe-overzoom
|
||||
|
||||
@@ -439,6 +439,10 @@ overzoom-test: tippecanoe-overzoom
|
||||
./tippecanoe-decode tests/pbf/countries-8-135-86-bigclip.pbf 8 135 86 > tests/pbf/countries-8-135-86-bigclip.json.check
|
||||
cmp tests/pbf/countries-8-135-86-bigclip.json.check tests/pbf/countries-8-135-86-bigclip.json
|
||||
rm tests/pbf/countries-8-135-86-bigclip.pbf tests/pbf/countries-8-135-86-bigclip.json.check
|
||||
# Clip region that does not intersect with the tile
|
||||
./tippecanoe-overzoom -o tests/pbf/squirrels-13-2413-3077-clip.pbf --clip-polygon-file tests/pbf/squirrels-clip.json tests/pbf/squirrels-13-2413-3077.pbf 13/2413/3077 13/2413/3077
|
||||
cmp tests/pbf/squirrels-13-2413-3077-clip.pbf /dev/null # clipped away
|
||||
rm tests/pbf/squirrels-13-2413-3077-clip.pbf
|
||||
|
||||
join-test: tippecanoe tippecanoe-decode tile-join
|
||||
./tippecanoe -q -f -z12 -o tests/join-population/tabblock_06001420.mbtiles -YALAND10:'Land area' -L'{"file": "tests/join-population/tabblock_06001420.json", "description": "population"}'
|
||||
|
||||
+11
-1
@@ -294,6 +294,7 @@ int main(int argc, char **argv) {
|
||||
// clip the clip polygons, if any, to the tile bounds,
|
||||
// to reduce their complexity
|
||||
|
||||
bool clipped_to_nothing = false;
|
||||
if (clipbboxes.size() > 0) {
|
||||
long long wx1 = (nx - buffer / 256.0) * (1LL << (32 - nz));
|
||||
long long wy1 = (ny - buffer / 256.0) * (1LL << (32 - nz));
|
||||
@@ -315,10 +316,18 @@ int main(int argc, char **argv) {
|
||||
|
||||
if (c.dv.size() > 0) {
|
||||
c.dv = clip_poly_poly(c.dv, tile_bounds);
|
||||
|
||||
if (c.dv.size() == 0) {
|
||||
clipped_to_nothing = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string out;
|
||||
|
||||
if (!clipped_to_nothing) {
|
||||
json_object *json_filter = NULL;
|
||||
if (filter.size() > 0) {
|
||||
json_filter = parse_filter(filter.c_str());
|
||||
@@ -345,7 +354,8 @@ int main(int argc, char **argv) {
|
||||
its.push_back(std::move(t));
|
||||
}
|
||||
|
||||
std::string out = overzoom(its, nz, nx, ny, detail, buffer, keep, exclude, exclude_prefix, do_compress, NULL, demultiply, json_filter, preserve_input_order, attribute_accum, unidecode_data, simplification, tiny_polygon_size, bins, bin_by_id_list, accumulate_numeric, SIZE_MAX, clipbboxes);
|
||||
out = overzoom(its, nz, nx, ny, detail, buffer, keep, exclude, exclude_prefix, do_compress, NULL, demultiply, json_filter, preserve_input_order, attribute_accum, unidecode_data, simplification, tiny_polygon_size, bins, bin_by_id_list, accumulate_numeric, SIZE_MAX, clipbboxes);
|
||||
}
|
||||
|
||||
FILE *f = fopen(outfile, "wb");
|
||||
if (f == NULL) {
|
||||
|
||||
+3
-1
@@ -11,6 +11,8 @@ size_t calc_memsize();
|
||||
|
||||
size_t get_max_open_files();
|
||||
|
||||
constexpr const char *get_null_device() { return "/dev/null"; }
|
||||
constexpr const char *get_null_device() {
|
||||
return "/dev/null";
|
||||
}
|
||||
|
||||
#endif // PLATFORM_HPP
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"coordinates":[[[-73.9722549,40.7904659],[-73.9755817,40.7674848],[-73.938783,40.767022],[-73.9457082,40.7791562],[-73.9628855,40.7760201],[-73.9629534,40.7914425],[-73.9722549,40.7904659]]],"crs":{"properties":{"name":"EPSG:4326"},"type":"name"},"type":"Polygon"}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define VERSION "v2.72.0"
|
||||
#define VERSION "v2.73.0"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user