Clean up polygon geometry again after coalescing

This commit is contained in:
Eric Fischer 2016-04-18 15:46:07 -07:00
parent 2a6e41126f
commit 86b8567201
8 changed files with 58 additions and 4 deletions

View File

@ -1,3 +1,7 @@
## 1.9.14
* Clean up polygons after coalescing, if necessary
## 1.9.13
* Don't trust the OS so much about how many files can be open

View File

@ -111,7 +111,9 @@ resolution is obtained than by using a smaller _maxzoom_ or _detail_.
### Doing more
* -ac or --coalesce: Coalesce adjacent line and polygon features that have the same properties
* -ac or --coalesce: Coalesce adjacent line and polygon features that have the same properties.
Note that when overlapping polygons are coalesced, the overlapping region is treated as a hole,
which may not be what you want.
* -ar or --reverse: Try reversing the directions of lines to make them coalesce and compress better
* -ao or --reorder: Reorder features to put ones with the same properties in sequence, to try to get them to coalesce
* -al or --drop-lines: Let "dot" dropping at lower zooms apply to lines too

View File

@ -134,7 +134,9 @@ compensate for the larger marker, or \-rf\fInumber\fP to allow at most \fInumber
.SS Doing more
.RS
.IP \(bu 2
\-ac or \-\-coalesce: Coalesce adjacent line and polygon features that have the same properties
\-ac or \-\-coalesce: Coalesce adjacent line and polygon features that have the same properties.
Note that when overlapping polygons are coalesced, the overlapping region is treated as a hole,
which may not be what you want.
.IP \(bu 2
\-ar or \-\-reverse: Try reversing the directions of lines to make them coalesce and compress better
.IP \(bu 2

1
tests/overlap/in.json Normal file
View File

@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-81.5625,63.39152174400882],[-113.90625,53.12040528310657],[-135.703125,29.22889003019423],[-118.125,-9.79567758282973],[-75.9375,-31.353636941500987],[-17.578125,-22.593726063929296],[-5.625,8.407168163601076],[-10.1953125,50.51342652633956],[-28.125,59.712097173322924],[-81.5625,63.39152174400882]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-93.515625,75.32002523220804],[-113.90625,69.41124235697256],[-117.0703125,60.06484046010452],[-103.35937499999999,39.36827914916011],[-71.3671875,29.84064389983444],[-37.265625,34.88593094075317],[-3.515625,61.270232790000634],[-33.3984375,79.03843742487174],[-74.8828125,79.17133464081945],[-93.515625,75.32002523220804]]]}}]}

View File

@ -0,0 +1,20 @@
{ "type": "FeatureCollection", "properties": {
"bounds": "-135.703125,-31.353637,-3.515625,79.171335",
"center": "-3.515625,0.000000,0",
"description": "tests/overlap/out/-z0.json.check.mbtiles",
"format": "pbf",
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {} } ] }",
"maxzoom": "0",
"minzoom": "0",
"name": "tests/overlap/out/-z0.json.check.mbtiles",
"type": "overlay",
"version": "2"
}, "features": [
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -33.398438, 79.038437 ], [ -3.515625, 61.312452 ], [ -37.265625, 34.957995 ], [ -71.367188, 29.916852 ], [ -103.359375, 39.368279 ], [ -117.070312, 60.108670 ], [ -113.906250, 69.442128 ], [ -93.515625, 75.342282 ], [ -74.882812, 79.171335 ], [ -33.398438, 79.038437 ] ] ] } }
,
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -28.125000, 59.756395 ], [ -10.195312, 50.513427 ], [ -5.625000, 8.407168 ], [ -17.578125, -22.593726 ], [ -75.937500, -31.353637 ], [ -118.125000, -9.795678 ], [ -135.703125, 29.228890 ], [ -113.906250, 53.173119 ], [ -81.562500, 63.391522 ], [ -28.125000, 59.756395 ] ] ] } }
] }
] }
] }

View File

@ -0,0 +1,18 @@
{ "type": "FeatureCollection", "properties": {
"bounds": "-135.703125,-31.353637,-3.515625,79.171335",
"center": "-3.515625,0.000000,0",
"description": "tests/overlap/out/-z0_--coalesce.json.check.mbtiles",
"format": "pbf",
"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 0, \"fields\": {} } ] }",
"maxzoom": "0",
"minzoom": "0",
"name": "tests/overlap/out/-z0_--coalesce.json.check.mbtiles",
"type": "overlay",
"version": "2"
}, "features": [
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in" }, "features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -33.398438, 79.038437 ], [ -3.515625, 61.312452 ], [ -15.556641, 53.488046 ], [ -10.195312, 50.513427 ], [ -5.625000, 8.407168 ], [ -17.578125, -22.593726 ], [ -75.937500, -31.353637 ], [ -118.125000, -9.795678 ], [ -135.703125, 29.228890 ], [ -113.906250, 53.173119 ], [ -112.236328, 53.800651 ], [ -117.070312, 60.108670 ], [ -113.906250, 69.442128 ], [ -93.515625, 75.342282 ], [ -74.882812, 79.171335 ], [ -33.398438, 79.038437 ] ], [ [ -112.236328, 53.800651 ], [ -103.359375, 39.368279 ], [ -71.367188, 29.916852 ], [ -37.265625, 34.957995 ], [ -15.556641, 53.488046 ], [ -28.125000, 59.756395 ], [ -81.562500, 63.391522 ], [ -112.236328, 53.800651 ] ] ] } }
] }
] }
] }

View File

@ -538,7 +538,6 @@ void *partial_feature_worker(void *v) {
// Give Clipper a chance to try to fix it.
for (size_t i = 0; i < geoms.size(); i++) {
geoms[i] = clean_or_clip_poly(geoms[i], 0, 0, 0, false);
geoms[i] = close_poly(geoms[i]);
}
}
@ -950,6 +949,14 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
features[j][x].geom = simplify_lines(features[j][x].geom, 32, 0);
}
if (features[j][x].type == VT_POLYGON) {
if (features[j][x].coalesced) {
features[j][x].geom = clean_or_clip_poly(features[j][x].geom, 0, 0, 0, false);
}
features[j][x].geom = close_poly(features[j][x].geom);
}
if (features[j][x].geom.size() > 0) {
out.push_back(features[j][x]);
}

View File

@ -1 +1 @@
#define VERSION "tippecanoe v1.9.13\n"
#define VERSION "tippecanoe v1.9.14\n"