With -pn, snap-round each layer's polygons consistently with each other

Wagyu snaps each edge to every "hot pixel" (vertex or rounded intersection)
that it passes through. Each polygon was cleaned on its own, with only its
own hot pixels, so a border shared by two polygons could be bent through a
hot pixel in one of them and not in the other, leaving a shard gap or overlap
between them even though --no-simplification-of-shared-nodes had simplified
and rounded the border identically in both. (In Dane County tile 11/515/751,
rounding moved one of a block's own vertices across its border with a sliver,
and cleaning bent the block's copy of the border through a hot pixel that the
sliver's copy didn't have.)

Wagyu now has hot_pixels(), which returns the hot pixels of the rings added
to it, and add_hot_pixels(), which gives execute() more hot pixels to snap
to. When extra hot pixels are given, edges are snapped to every hot pixel
they touch, including corner touches, so that whether a shared edge is
snapped to a hot pixel can't depend on which polygon it is in.

With -pn, the simplification worker now runs in two passes. The first
simplifies and rounds every feature in the tile. Then the hot pixels of all
the polygons in each layer are found together, which also finds crossings
between features that no single feature would see. The second pass cleans
each polygon with the layer's hot pixels near it as well as its own, so
the borders it shares are snapped identically in each polygon. This is
snap rounding of the whole layer's arrangement at once, so the result is
still free of crossings.

For Dane County Census blocks at -D8 -d8 -pt -pn, tiles 12/1031/1503 and
11/515/751 now have no gaps between blocks (from 10 and 23 pixels), and the
gaps and overlaps at z9 and z10 go from 55/113 and 155/175 to 13/56 and 23/59
pixels, with no self-intersecting polygons. Natural Earth 10m countries at
-z8 -pn take about 7% longer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CQ6vQUJtmGZnqz7RmVYQaJ
This commit is contained in:
Claude
2026-12-01 00:09:18 +00:00
parent 5e1240b341
commit 162cb1c1b0
12 changed files with 366 additions and 99 deletions
+12
View File
@@ -36,6 +36,18 @@
borders that the polygon shares with other features, and a polygon whose
borders are all shared is left out entirely, so that its neighbors close
over the space instead of being overlapped.
* With --no-simplification-of-shared-nodes, snap-round the polygons of each
layer in a tile consistently with each other. Wagyu snaps each edge to the
"hot pixels" (vertices and rounded intersections) that it passes through,
but each polygon was cleaned on its own, with only its own hot pixels, so a
border shared by two polygons could be bent through a hot pixel in one of
them and not the other, leaving a shard gap or overlap between them. Now the
hot pixels of all the polygons in the layer are found first, and each polygon
is snapped to the ones near it as well as its own, so shared borders are
snapped identically. For Dane County Census blocks at -D8 -d8 -pt -pn, this
reduces the gaps between blocks at z9 and z10 from 55 and 155 pixels to 13
and 23, and the overlaps from 113 and 175 to 56 and 59, and takes about 7%
longer for Natural Earth countries at -z8 -pn.
* Fix Wagyu's snap rounding so that an edge that intersects no other edge
is no longer snapped to a hot pixel whose corner it only touches, unless
that hot pixel is the rounded location of an intersection. Previously, two
+1 -1
View File
@@ -509,7 +509,7 @@ the same layer, enclose them in an `all` expression so they will all be evaluate
* `-ps` or `--no-line-simplification`: Don't simplify lines and polygons
* `-pS` or `--simplify-only-low-zooms`: Don't simplify lines and polygons at maxzoom (but do simplify at lower zooms)
* `--simplification-at-maximum-zoom=`_scale_: Use the specified _scale_ at maxzoom instead of the standard simplification scale (which still applies at lower zooms)
* `-pn` or `--no-simplification-of-shared-nodes`: Don't simplify away nodes at which LineStrings or Polygon rings converge, diverge, or cross. (This will not be effective if you also use `--coalesce`.) In between intersection nodes, LineString segments or polygon edges will be simplified identically in each feature if possible. Use this instead of `--detect-shared-borders`.
* `-pn` or `--no-simplification-of-shared-nodes`: Don't simplify away nodes at which LineStrings or Polygon rings converge, diverge, or cross. (This will not be effective if you also use `--coalesce`.) In between intersection nodes, LineString segments or polygon edges will be simplified identically in each feature if possible. Polygons in the same layer are also snap-rounded to tile coordinates consistently with each other, so that the borders they share are snapped identically and do not leave gaps or overlaps between them. Use this instead of `--detect-shared-borders`.
* `-pt` or `--no-tiny-polygon-reduction`: Don't combine the area of very small polygons into small squares that represent their combined area.
* `-pT` or `--no-tiny-polygon-reduction-at-maximum-zoom`: Combine the area of very small polygons into small squares that represent their combined area only at zoom levels below the maximum.
* `--tiny-polygon-size=`_size_: Use the specified _size_ for tiny polygons instead of the default 2. Anything above 6 or so will lead to visible artifacts with the default tile detail.
+1 -1
View File
@@ -542,7 +542,7 @@ the line or polygon within one tile unit of its proper location. You can probabl
.IP \(bu 2
\fB--simplification-at-maximum-zoom=\fR\fIscale\fP: Use the specified \fIscale\fP at maxzoom instead of the standard simplification scale (which still applies at lower zooms)
.IP \(bu 2
\fB-pn\fR or \fB--no-simplification-of-shared-nodes\fR: Don't simplify away nodes at which LineStrings or Polygon rings converge, diverge, or cross. (This will not be effective if you also use \fB--coalesce\fR\&.) In between intersection nodes, LineString segments or polygon edges will be simplified identically in each feature if possible. Use this instead of \fB--detect-shared-borders\fR\&.
\fB-pn\fR or \fB--no-simplification-of-shared-nodes\fR: Don't simplify away nodes at which LineStrings or Polygon rings converge, diverge, or cross. (This will not be effective if you also use \fB--coalesce\fR\&.) In between intersection nodes, LineString segments or polygon edges will be simplified identically in each feature if possible. Polygons in the same layer are also snap-rounded to tile coordinates consistently with each other, so that the borders they share are snapped identically and do not leave gaps or overlaps between them. Use this instead of \fB--detect-shared-borders\fR\&.
.IP \(bu 2
\fB-pt\fR or \fB--no-tiny-polygon-reduction\fR: Don't combine the area of very small polygons into small squares that represent their combined area.
.IP \(bu 2
+2
View File
@@ -162,6 +162,8 @@ struct ring_manager {
// The hot pixels that are the rounded locations of intersections, sorted,
// which edges must be snapped to even if they only touch their corners
hot_pixel_vector<T> intersection_hot_pixels;
// Snap edges to every hot pixel they touch, even ones whose corners they only touch
bool snap_all_corners = false;
hot_pixel_itr<T> current_hp_itr;
std::deque<point<T>> points;
std::deque<ring<T>> rings;
+2 -2
View File
@@ -220,7 +220,7 @@ void hot_pixel_set_left_to_right(T y,
if (!add_end_point && itr->x == end_x) {
continue;
}
if ((itr->x < x_min_inward || itr->x > x_max_inward) && !bnd.current_edge->intersected &&
if ((itr->x < x_min_inward || itr->x > x_max_inward) && !rings.snap_all_corners && !bnd.current_edge->intersected &&
!std::binary_search(rings.intersection_hot_pixels.begin(), rings.intersection_hot_pixels.end(), *itr,
hot_pixel_sorter<T>())) {
continue;
@@ -270,7 +270,7 @@ void hot_pixel_set_right_to_left(T y,
if (!add_end_point && itr->x == end_x) {
continue;
}
if ((itr->x < x_min_inward || itr->x > x_max_inward) && !bnd.current_edge->intersected &&
if ((itr->x < x_min_inward || itr->x > x_max_inward) && !rings.snap_all_corners && !bnd.current_edge->intersected &&
!std::binary_search(rings.intersection_hot_pixels.begin(), rings.intersection_hot_pixels.end(), *itr,
hot_pixel_sorter<T>())) {
continue;
+30 -1
View File
@@ -31,12 +31,36 @@ class wagyu {
private:
local_minimum_list<T> minima_list;
bool reverse_output;
std::vector<mapbox::geometry::point<T>> extra_hot_pixels;
wagyu(wagyu const&) = delete;
wagyu& operator=(wagyu const&) = delete;
public:
wagyu() : minima_list(), reverse_output(false) {
wagyu() : minima_list(), reverse_output(false), extra_hot_pixels() {
}
// The hot pixels (the vertices and the rounded locations of intersections)
// of the rings that have been added so far. Running this on all the rings
// of several separate geometries, and passing the result to add_hot_pixels()
// for each of them, makes edges that the geometries share snap identically
// in each of them. This uses up the added rings, so it should be called on a
// wagyu that is only being used to find hot pixels, not to execute.
std::vector<mapbox::geometry::point<T>> hot_pixels() {
ring_manager<T> manager;
if (!minima_list.empty()) {
build_hot_pixels(minima_list, manager);
}
return std::move(manager.hot_pixels);
}
// Additional hot pixels, from hot_pixels() of a larger set of rings, for edges
// to be snapped to as well as the hot pixels of the rings themselves. When these
// are provided, edges are snapped to every hot pixel they touch, including those
// whose corners they only touch, so that whether a shared edge is snapped to a
// hot pixel does not depend on which geometry it is part of.
void add_hot_pixels(std::vector<mapbox::geometry::point<T>> const& pixels) {
extra_hot_pixels.insert(extra_hot_pixels.end(), pixels.begin(), pixels.end());
}
~wagyu() {
@@ -126,6 +150,11 @@ public:
interrupt_check(); // Check for interruptions
build_hot_pixels(minima_list, manager);
if (!extra_hot_pixels.empty()) {
manager.snap_all_corners = true;
manager.hot_pixels.insert(manager.hot_pixels.end(), extra_hot_pixels.begin(), extra_hot_pixels.end());
sort_hot_pixels(manager);
}
interrupt_check(); // Check for interruptions
+73 -3
View File
@@ -523,7 +523,33 @@ static void add_rings(mapbox::geometry::wagyu::wagyu<long long> &wagyu, drawvec
// at `scale` times tile resolution, and round the result back to tile resolution.
// Returns false, rather than exiting, if wagyu fails, since the callers have
// a valid polygon to fall back on.
static bool wagyu_union(drawvec const &subject, drawvec const *clip, long long scale, drawvec &out, bool require_exact) {
// The hot pixels from `hot` (sorted by y, then x) that are within a pixel of
// the bounding box of `geom`, which are the only ones its edges could touch
static std::vector<mapbox::geometry::point<long long>> hot_pixels_near(drawvec const &geom, hot_pixel_list const &hot) {
std::vector<mapbox::geometry::point<long long>> out;
if (geom.size() == 0 || hot.size() == 0) {
return out;
}
long long minx = LLONG_MAX, miny = LLONG_MAX, maxx = LLONG_MIN, maxy = LLONG_MIN;
for (auto const &d : geom) {
minx = std::min(minx, (long long) d.x);
miny = std::min(miny, (long long) d.y);
maxx = std::max(maxx, (long long) d.x);
maxy = std::max(maxy, (long long) d.y);
}
for (long long y = miny - 1; y <= maxy + 1; y++) {
auto it = std::lower_bound(hot.begin(), hot.end(), std::make_pair(y, minx - 1));
for (; it != hot.end() && it->first == y && it->second <= maxx + 1; ++it) {
out.emplace_back(it->second, it->first);
}
}
return out;
}
static bool wagyu_union(drawvec const &subject, drawvec const *clip, long long scale, drawvec &out, bool require_exact, hot_pixel_list const *hot = NULL) {
mapbox::geometry::multi_polygon<long long> result;
try {
@@ -532,6 +558,16 @@ static bool wagyu_union(drawvec const &subject, drawvec const *clip, long long s
if (clip != NULL) {
add_rings(wagyu, *clip, mapbox::geometry::wagyu::polygon_type_clip, scale);
}
if (hot != NULL && scale == 1) {
drawvec both = subject;
if (clip != NULL) {
both.insert(both.end(), clip->begin(), clip->end());
}
std::vector<mapbox::geometry::point<long long>> near = hot_pixels_near(both, *hot);
if (near.size() > 0) {
wagyu.add_hot_pixels(near);
}
}
wagyu.execute(mapbox::geometry::wagyu::clip_type_union, result, mapbox::geometry::wagyu::fill_type_positive, mapbox::geometry::wagyu::fill_type_non_zero);
} catch (std::runtime_error &e) {
return false;
@@ -555,7 +591,7 @@ static bool wagyu_union(drawvec const &subject, drawvec const *clip, long long s
return true;
}
drawvec union_polygon_strips(drawvec const &geom, drawvec const &strips) {
drawvec union_polygon_strips(drawvec const &geom, drawvec const &strips, hot_pixel_list const *hot) {
if (strips.size() == 0) {
return geom;
}
@@ -586,8 +622,14 @@ drawvec union_polygon_strips(drawvec const &geom, drawvec const &strips) {
// Clean the rounded union at tile resolution, the same way
// clean_or_clip_poly() would, but without exiting on failure.
// (Or, if there is a set of hot pixels to snap to consistently
// with other features, at tile resolution with those.)
drawvec out;
if (wagyu_union(unioned, NULL, 16, out, true)) {
if (hot != NULL) {
if (wagyu_union(unioned, NULL, 1, out, false, hot)) {
return out;
}
} else if (wagyu_union(unioned, NULL, 16, out, true)) {
return out;
}
if (wagyu_union(unioned, NULL, 1, out, false)) {
@@ -598,3 +640,31 @@ drawvec union_polygon_strips(drawvec const &geom, drawvec const &strips) {
}
return geom;
}
hot_pixel_list layer_hot_pixels(std::vector<drawvec const *> const &geoms) {
hot_pixel_list out;
try {
mapbox::geometry::wagyu::wagyu<long long> wagyu;
for (auto const *g : geoms) {
add_rings(wagyu, *g, mapbox::geometry::wagyu::polygon_type_subject, 1);
}
for (auto const &p : wagyu.hot_pixels()) {
out.emplace_back(p.y, p.x);
}
} catch (std::runtime_error &e) {
// Without a consistent set of hot pixels, each feature is
// just snapped to its own, as it would otherwise be.
out.clear();
}
std::sort(out.begin(), out.end());
out.erase(std::unique(out.begin(), out.end()), out.end());
return out;
}
drawvec clean_polygon_with_hot_pixels(drawvec const &geom, hot_pixel_list const &hot, bool *ok) {
drawvec out;
*ok = wagyu_union(geom, NULL, 1, out, false, &hot);
return out;
}
+17 -2
View File
@@ -38,8 +38,23 @@ double unshared_perimeter(drawvec const &geom, size_t i, size_t j, long long ox,
// already cover the space, and *all_shared is set if every edge was shared.
drawvec outline_strips(drawvec const &geom, int z, int detail, double simplification, long long ox, long long oy, bool *all_shared);
// Hot pixels for snap rounding, as (y, x) in tile coordinates, sorted
typedef std::vector<std::pair<long long, long long>> hot_pixel_list;
// Union the strips from thin_polygon_strips() with a cleaned polygon
// (both in tile coordinates)
drawvec union_polygon_strips(drawvec const &geom, drawvec const &strips);
// (both in tile coordinates). If `hot` is provided, the result is snapped
// to those hot pixels as in clean_polygon_with_hot_pixels().
drawvec union_polygon_strips(drawvec const &geom, drawvec const &strips, hot_pixel_list const *hot = NULL);
// The hot pixels (vertices and rounded intersections) of all the polygons in
// `geoms` (in tile coordinates), so that each of them can be cleaned with
// clean_polygon_with_hot_pixels() and edges that they share are snapped
// identically in each, instead of differently depending on which other
// vertices each polygon happens to have.
hot_pixel_list layer_hot_pixels(std::vector<drawvec const *> const &geoms);
// Clean a polygon (in tile coordinates), snapping its edges to the hot pixels
// from layer_hot_pixels() as well as its own. Sets *ok to false if that fails.
drawvec clean_polygon_with_hot_pixels(drawvec const &geom, hot_pixel_list const &hot, bool *ok);
#endif
File diff suppressed because one or more lines are too long
+18 -18
View File
@@ -17,11 +17,11 @@
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { "name": "D" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.316406, 39.909736 ], [ -99.316406, 39.842286 ], [ -100.019531, 39.842286 ], [ -100.019531, 39.909736 ], [ -99.316406, 39.909736 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "R" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -100.019531, 39.842286 ], [ -99.316406, 39.774769 ], [ -99.316406, 39.707187 ], [ -100.019531, 39.707187 ], [ -100.019531, 39.842286 ] ] ] } }
{ "type": "Feature", "properties": { "name": "R" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -100.019531, 39.842286 ], [ -99.492188, 39.774769 ], [ -99.316406, 39.774769 ], [ -99.316406, 39.707187 ], [ -100.019531, 39.707187 ], [ -100.019531, 39.774769 ], [ -100.019531, 39.842286 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -100.019531, 40.044438 ], [ -99.316406, 39.977120 ], [ -100.019531, 39.977120 ], [ -100.019531, 40.044438 ] ] ] } }
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.492188, 39.977120 ], [ -100.019531, 39.977120 ], [ -100.019531, 40.044438 ], [ -99.931641, 40.044438 ], [ -99.755859, 40.044438 ], [ -99.492188, 39.977120 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.931641, 40.044438 ], [ -99.492188, 39.977120 ], [ -99.316406, 39.977120 ], [ -99.316406, 39.909736 ], [ -100.019531, 39.909736 ], [ -100.019531, 39.977120 ], [ -99.931641, 40.044438 ] ] ] } }
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.755859, 40.044438 ], [ -99.492188, 39.977120 ], [ -99.316406, 39.977120 ], [ -99.316406, 39.909736 ], [ -100.019531, 39.909736 ], [ -100.019531, 39.977120 ], [ -100.019531, 40.044438 ], [ -99.931641, 40.044438 ], [ -99.755859, 40.044438 ] ] ] } }
] }
] }
,
@@ -31,9 +31,9 @@
,
{ "type": "Feature", "properties": { "name": "D" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.316406, 39.876019 ], [ -99.316406, 39.808536 ], [ -100.019531, 39.842286 ], [ -100.019531, 39.876019 ], [ -99.316406, 39.876019 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "R" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -100.019531, 39.774769 ], [ -99.316406, 39.740986 ], [ -99.316406, 39.673370 ], [ -99.448242, 39.707187 ], [ -100.019531, 39.707187 ], [ -100.019531, 39.774769 ] ] ] } }
{ "type": "Feature", "properties": { "name": "R" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -100.019531, 39.774769 ], [ -99.448242, 39.740986 ], [ -99.316406, 39.740986 ], [ -99.316406, 39.707187 ], [ -99.316406, 39.673370 ], [ -99.448242, 39.707187 ], [ -100.019531, 39.707187 ], [ -100.019531, 39.740986 ], [ -100.019531, 39.774769 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.316406, 40.078071 ], [ -99.316406, 40.010787 ], [ -100.019531, 40.010787 ], [ -100.019531, 40.078071 ], [ -99.316406, 40.078071 ] ] ] } }
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.316406, 40.078071 ], [ -99.316406, 40.010787 ], [ -99.931641, 40.010787 ], [ -100.019531, 40.010787 ], [ -100.019531, 40.078071 ], [ -99.316406, 40.078071 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.931641, 40.010787 ], [ -99.492188, 39.977120 ], [ -99.316406, 40.010787 ], [ -99.316406, 39.943436 ], [ -100.019531, 39.943436 ], [ -100.019531, 40.010787 ], [ -99.931641, 40.010787 ] ] ] } }
] }
@@ -47,9 +47,9 @@
,
{ "type": "Feature", "properties": { "name": "R" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.448242, 39.757880 ], [ -99.294434, 39.724089 ], [ -99.294434, 39.690281 ], [ -99.448242, 39.724089 ], [ -99.558105, 39.690281 ], [ -99.711914, 39.724089 ], [ -99.887695, 39.690281 ], [ -99.997559, 39.724089 ], [ -99.997559, 39.757880 ], [ -99.887695, 39.724089 ], [ -99.711914, 39.757880 ], [ -99.558105, 39.724089 ], [ -99.448242, 39.757880 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.294434, 40.078071 ], [ -99.294434, 40.010787 ], [ -99.492188, 39.977120 ], [ -99.645996, 40.010787 ], [ -99.755859, 39.977120 ], [ -99.909668, 40.010787 ], [ -99.997559, 39.993956 ], [ -99.997559, 40.078071 ], [ -99.294434, 40.078071 ] ] ] } }
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.294434, 40.078071 ], [ -99.294434, 40.010787 ], [ -99.492188, 39.977120 ], [ -99.645996, 40.010787 ], [ -99.755859, 39.977120 ], [ -99.821777, 39.993956 ], [ -99.865723, 39.993956 ], [ -99.909668, 40.010787 ], [ -99.931641, 40.010787 ], [ -99.997559, 39.993956 ], [ -99.997559, 40.078071 ], [ -99.294434, 40.078071 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.294434, 40.010787 ], [ -99.294434, 39.926588 ], [ -99.997559, 39.926588 ], [ -99.997559, 39.993956 ], [ -99.931641, 40.010787 ], [ -99.821777, 39.993956 ], [ -99.645996, 40.010787 ], [ -99.492188, 39.977120 ], [ -99.294434, 40.010787 ] ] ] } }
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.294434, 40.010787 ], [ -99.294434, 39.926588 ], [ -99.997559, 39.926588 ], [ -99.997559, 39.993956 ], [ -99.931641, 40.010787 ], [ -99.909668, 40.010787 ], [ -99.865723, 39.993956 ], [ -99.821777, 39.993956 ], [ -99.645996, 40.010787 ], [ -99.492188, 39.977120 ], [ -99.294434, 40.010787 ] ] ] } }
] }
] }
,
@@ -61,9 +61,9 @@
,
{ "type": "Feature", "properties": { "name": "R" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.448242, 39.757880 ], [ -99.294434, 39.724089 ], [ -99.294434, 39.707187 ], [ -99.448242, 39.740986 ], [ -99.558105, 39.707187 ], [ -99.624023, 39.707187 ], [ -99.722900, 39.740986 ], [ -99.887695, 39.707187 ], [ -99.997559, 39.732538 ], [ -99.997559, 39.749434 ], [ -99.887695, 39.724089 ], [ -99.722900, 39.757880 ], [ -99.624023, 39.724089 ], [ -99.558105, 39.724089 ], [ -99.448242, 39.757880 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.294434, 40.069665 ], [ -99.294434, 40.002372 ], [ -99.316406, 40.019201 ], [ -99.382324, 40.010787 ], [ -99.481201, 39.985538 ], [ -99.645996, 40.019201 ], [ -99.755859, 39.985538 ], [ -99.821777, 39.985538 ], [ -99.920654, 40.019201 ], [ -99.997559, 40.002372 ], [ -99.997559, 40.069665 ], [ -99.294434, 40.069665 ] ] ] } }
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.294434, 40.069665 ], [ -99.294434, 40.002372 ], [ -99.316406, 40.019201 ], [ -99.382324, 40.010787 ], [ -99.481201, 39.985538 ], [ -99.645996, 40.019201 ], [ -99.744873, 39.985538 ], [ -99.755859, 39.985538 ], [ -99.810791, 39.985538 ], [ -99.821777, 39.985538 ], [ -99.920654, 40.019201 ], [ -99.997559, 40.002372 ], [ -99.997559, 40.069665 ], [ -99.294434, 40.069665 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.316406, 40.019201 ], [ -99.294434, 40.002372 ], [ -99.294434, 39.926588 ], [ -99.997559, 39.926588 ], [ -99.997559, 40.002372 ], [ -99.920654, 40.019201 ], [ -99.810791, 39.985538 ], [ -99.744873, 39.985538 ], [ -99.645996, 40.019201 ], [ -99.481201, 39.985538 ], [ -99.382324, 40.010787 ], [ -99.316406, 40.019201 ] ] ] } }
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.316406, 40.019201 ], [ -99.294434, 40.002372 ], [ -99.294434, 39.926588 ], [ -99.997559, 39.926588 ], [ -99.997559, 40.002372 ], [ -99.920654, 40.019201 ], [ -99.821777, 39.985538 ], [ -99.810791, 39.985538 ], [ -99.755859, 39.985538 ], [ -99.744873, 39.985538 ], [ -99.645996, 40.019201 ], [ -99.481201, 39.985538 ], [ -99.382324, 40.010787 ], [ -99.316406, 40.019201 ] ] ] } }
] }
] }
,
@@ -77,9 +77,9 @@
,
{ "type": "Feature", "properties": { "name": "P" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -99.750366, 39.985538 ], [ -99.717407, 40.002372 ], [ -99.684448, 40.002372 ], [ -99.717407, 39.998164 ], [ -99.750366, 39.985538 ] ] ], [ [ [ -99.926147, 40.014994 ], [ -99.920654, 40.019201 ], [ -99.882202, 40.002372 ], [ -99.926147, 40.014994 ] ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.294434, 40.073868 ], [ -99.294434, 40.006580 ], [ -99.321899, 40.014994 ], [ -99.354858, 40.006580 ], [ -99.382324, 40.010787 ], [ -99.420776, 39.993956 ], [ -99.453735, 39.993956 ], [ -99.486694, 39.981329 ], [ -99.519653, 39.993956 ], [ -99.552612, 39.993956 ], [ -99.585571, 40.010787 ], [ -99.618530, 40.010787 ], [ -99.645996, 40.014994 ], [ -99.684448, 40.002372 ], [ -99.717407, 40.002372 ], [ -99.755859, 39.985538 ], [ -99.783325, 39.989747 ], [ -99.816284, 39.985538 ], [ -99.849243, 40.002372 ], [ -99.882202, 40.002372 ], [ -99.920654, 40.019201 ], [ -99.953613, 40.006580 ], [ -99.981079, 40.010787 ], [ -99.997559, 39.998164 ], [ -99.997559, 40.073868 ], [ -99.294434, 40.073868 ] ] ] } }
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.294434, 40.073868 ], [ -99.294434, 40.006580 ], [ -99.321899, 40.014994 ], [ -99.354858, 40.006580 ], [ -99.382324, 40.010787 ], [ -99.420776, 39.993956 ], [ -99.453735, 39.993956 ], [ -99.486694, 39.981329 ], [ -99.519653, 39.993956 ], [ -99.552612, 39.993956 ], [ -99.585571, 40.010787 ], [ -99.618530, 40.010787 ], [ -99.645996, 40.014994 ], [ -99.684448, 40.002372 ], [ -99.717407, 40.002372 ], [ -99.750366, 39.985538 ], [ -99.755859, 39.985538 ], [ -99.783325, 39.989747 ], [ -99.810791, 39.985538 ], [ -99.816284, 39.985538 ], [ -99.832764, 39.993956 ], [ -99.849243, 40.002372 ], [ -99.854736, 40.002372 ], [ -99.882202, 40.002372 ], [ -99.920654, 40.019201 ], [ -99.926147, 40.014994 ], [ -99.953613, 40.006580 ], [ -99.981079, 40.010787 ], [ -99.997559, 39.998164 ], [ -99.997559, 40.073868 ], [ -99.294434, 40.073868 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.321899, 40.014994 ], [ -99.294434, 40.006580 ], [ -99.294434, 39.926588 ], [ -99.997559, 39.926588 ], [ -99.997559, 39.998164 ], [ -99.981079, 40.010787 ], [ -99.953613, 40.006580 ], [ -99.926147, 40.014994 ], [ -99.882202, 40.002372 ], [ -99.854736, 40.002372 ], [ -99.810791, 39.985538 ], [ -99.783325, 39.989747 ], [ -99.750366, 39.985538 ], [ -99.717407, 39.998164 ], [ -99.684448, 40.002372 ], [ -99.645996, 40.014994 ], [ -99.618530, 40.010787 ], [ -99.585571, 40.010787 ], [ -99.552612, 39.993956 ], [ -99.519653, 39.993956 ], [ -99.486694, 39.981329 ], [ -99.453735, 39.993956 ], [ -99.420776, 39.993956 ], [ -99.382324, 40.010787 ], [ -99.354858, 40.006580 ], [ -99.321899, 40.014994 ] ] ] } }
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.321899, 40.014994 ], [ -99.294434, 40.006580 ], [ -99.294434, 39.926588 ], [ -99.997559, 39.926588 ], [ -99.997559, 39.998164 ], [ -99.981079, 40.010787 ], [ -99.953613, 40.006580 ], [ -99.926147, 40.014994 ], [ -99.882202, 40.002372 ], [ -99.854736, 40.002372 ], [ -99.849243, 40.002372 ], [ -99.832764, 39.993956 ], [ -99.816284, 39.985538 ], [ -99.810791, 39.985538 ], [ -99.783325, 39.989747 ], [ -99.755859, 39.985538 ], [ -99.750366, 39.985538 ], [ -99.717407, 39.998164 ], [ -99.684448, 40.002372 ], [ -99.645996, 40.014994 ], [ -99.618530, 40.010787 ], [ -99.585571, 40.010787 ], [ -99.552612, 39.993956 ], [ -99.519653, 39.993956 ], [ -99.486694, 39.981329 ], [ -99.453735, 39.993956 ], [ -99.420776, 39.993956 ], [ -99.382324, 40.010787 ], [ -99.354858, 40.006580 ], [ -99.321899, 40.014994 ] ] ] } }
] }
] }
,
@@ -93,9 +93,9 @@
,
{ "type": "Feature", "properties": { "name": "P" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -99.717407, 40.000268 ], [ -99.747620, 39.985538 ], [ -99.753113, 39.985538 ], [ -99.717407, 40.000268 ] ] ], [ [ [ -99.783325, 39.989747 ], [ -99.813538, 39.985538 ], [ -99.819031, 39.987643 ], [ -99.783325, 39.989747 ] ] ], [ [ [ -99.582825, 40.010787 ], [ -99.555359, 39.996060 ], [ -99.519653, 39.993956 ], [ -99.555359, 39.993956 ], [ -99.582825, 40.010787 ] ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.297180, 40.071766 ], [ -99.297180, 40.006580 ], [ -99.319153, 40.017098 ], [ -99.354858, 40.008683 ], [ -99.385071, 40.010787 ], [ -99.420776, 39.993956 ], [ -99.453735, 39.993956 ], [ -99.483948, 39.983434 ], [ -99.519653, 39.993956 ], [ -99.555359, 39.996060 ], [ -99.582825, 40.010787 ], [ -99.618530, 40.008683 ], [ -99.648743, 40.017098 ], [ -99.684448, 40.002372 ], [ -99.717407, 40.000268 ], [ -99.753113, 39.985538 ], [ -99.783325, 39.989747 ], [ -99.819031, 39.987643 ], [ -99.846497, 40.002372 ], [ -99.882202, 40.004476 ], [ -99.917908, 40.017098 ], [ -99.953613, 40.006580 ], [ -99.981079, 40.008683 ], [ -100.000305, 40.000268 ], [ -100.000305, 40.071766 ], [ -99.297180, 40.071766 ] ] ] } }
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.297180, 40.071766 ], [ -99.297180, 40.006580 ], [ -99.319153, 40.017098 ], [ -99.354858, 40.008683 ], [ -99.385071, 40.010787 ], [ -99.420776, 39.993956 ], [ -99.453735, 39.993956 ], [ -99.483948, 39.983434 ], [ -99.519653, 39.993956 ], [ -99.555359, 39.996060 ], [ -99.582825, 40.010787 ], [ -99.618530, 40.008683 ], [ -99.648743, 40.017098 ], [ -99.684448, 40.002372 ], [ -99.717407, 40.000268 ], [ -99.753113, 39.985538 ], [ -99.758606, 39.985538 ], [ -99.783325, 39.989747 ], [ -99.819031, 39.987643 ], [ -99.824524, 39.989747 ], [ -99.846497, 40.002372 ], [ -99.851990, 40.002372 ], [ -99.882202, 40.004476 ], [ -99.917908, 40.017098 ], [ -99.953613, 40.006580 ], [ -99.981079, 40.008683 ], [ -100.000305, 40.000268 ], [ -100.000305, 40.071766 ], [ -99.297180, 40.071766 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.912415, 40.017098 ], [ -99.882202, 40.004476 ], [ -99.854736, 40.004476 ], [ -99.813538, 39.985538 ], [ -99.783325, 39.989747 ], [ -99.758606, 39.985538 ], [ -99.747620, 39.985538 ], [ -99.717407, 40.000268 ], [ -99.684448, 40.002372 ], [ -99.648743, 40.017098 ], [ -99.618530, 40.008683 ], [ -99.582825, 40.010787 ], [ -99.555359, 39.993956 ], [ -99.519653, 39.993956 ], [ -99.483948, 39.983434 ], [ -99.453735, 39.993956 ], [ -99.420776, 39.993956 ], [ -99.385071, 40.010787 ], [ -99.354858, 40.008683 ], [ -99.319153, 40.017098 ], [ -99.297180, 40.006580 ], [ -99.297180, 39.928695 ], [ -100.000305, 39.928695 ], [ -100.000305, 40.000268 ], [ -99.981079, 40.008683 ], [ -99.953613, 40.006580 ], [ -99.923401, 40.017098 ], [ -99.912415, 40.017098 ] ] ] } }
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.912415, 40.017098 ], [ -99.882202, 40.004476 ], [ -99.854736, 40.004476 ], [ -99.851990, 40.002372 ], [ -99.846497, 40.002372 ], [ -99.824524, 39.989747 ], [ -99.819031, 39.987643 ], [ -99.813538, 39.985538 ], [ -99.783325, 39.989747 ], [ -99.758606, 39.985538 ], [ -99.753113, 39.985538 ], [ -99.747620, 39.985538 ], [ -99.717407, 40.000268 ], [ -99.684448, 40.002372 ], [ -99.648743, 40.017098 ], [ -99.618530, 40.008683 ], [ -99.582825, 40.010787 ], [ -99.555359, 39.993956 ], [ -99.519653, 39.993956 ], [ -99.483948, 39.983434 ], [ -99.453735, 39.993956 ], [ -99.420776, 39.993956 ], [ -99.385071, 40.010787 ], [ -99.354858, 40.008683 ], [ -99.319153, 40.017098 ], [ -99.297180, 40.006580 ], [ -99.297180, 39.928695 ], [ -100.000305, 39.928695 ], [ -100.000305, 40.000268 ], [ -99.981079, 40.008683 ], [ -99.953613, 40.006580 ], [ -99.923401, 40.017098 ], [ -99.917908, 40.017098 ], [ -99.912415, 40.017098 ] ] ] } }
] }
] }
,
@@ -105,13 +105,13 @@
,
{ "type": "Feature", "properties": { "name": "D" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.295807, 39.891826 ], [ -99.295807, 39.813811 ], [ -99.320526, 39.827522 ], [ -99.326019, 39.828577 ], [ -99.354858, 39.827522 ], [ -99.383698, 39.838068 ], [ -99.396057, 39.835959 ], [ -99.419403, 39.826468 ], [ -99.442749, 39.826468 ], [ -99.455109, 39.825413 ], [ -99.483948, 39.809591 ], [ -99.496307, 39.808536 ], [ -99.519653, 39.811701 ], [ -99.548492, 39.804316 ], [ -99.560852, 39.806426 ], [ -99.584198, 39.819085 ], [ -99.618530, 39.820139 ], [ -99.641876, 39.832796 ], [ -99.654236, 39.835959 ], [ -99.683075, 39.829632 ], [ -99.706421, 39.833850 ], [ -99.718781, 39.833850 ], [ -99.753113, 39.815920 ], [ -99.783325, 39.815920 ], [ -99.806671, 39.806426 ], [ -99.817657, 39.803261 ], [ -99.853363, 39.812756 ], [ -99.882202, 39.811701 ], [ -99.917908, 39.829632 ], [ -99.923401, 39.830686 ], [ -99.946747, 39.828577 ], [ -99.982452, 39.838068 ], [ -100.000305, 39.831741 ], [ -100.000305, 39.891826 ], [ -99.295807, 39.891826 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "R" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.718781, 39.748378 ], [ -99.706421, 39.746266 ], [ -99.683075, 39.735706 ], [ -99.654236, 39.735706 ], [ -99.618530, 39.718807 ], [ -99.607544, 39.718807 ], [ -99.584198, 39.721976 ], [ -99.553986, 39.715638 ], [ -99.542999, 39.718807 ], [ -99.519653, 39.731482 ], [ -99.489441, 39.731482 ], [ -99.478455, 39.735706 ], [ -99.460602, 39.745210 ], [ -99.448242, 39.747322 ], [ -99.419403, 39.740986 ], [ -99.396057, 39.744154 ], [ -99.383698, 39.743098 ], [ -99.354858, 39.727257 ], [ -99.343872, 39.725145 ], [ -99.320526, 39.726201 ], [ -99.295807, 39.715638 ], [ -99.295807, 39.713525 ], [ -99.320526, 39.724089 ], [ -99.343872, 39.723032 ], [ -99.354858, 39.725145 ], [ -99.383698, 39.740986 ], [ -99.396057, 39.742042 ], [ -99.419403, 39.738874 ], [ -99.448242, 39.746266 ], [ -99.460602, 39.743098 ], [ -99.478455, 39.733594 ], [ -99.489441, 39.729370 ], [ -99.519653, 39.729370 ], [ -99.542999, 39.717751 ], [ -99.553986, 39.713525 ], [ -99.584198, 39.719863 ], [ -99.607544, 39.716694 ], [ -99.618530, 39.716694 ], [ -99.654236, 39.734650 ], [ -99.683075, 39.733594 ], [ -99.706421, 39.744154 ], [ -99.718781, 39.747322 ], [ -99.724274, 39.746266 ], [ -99.753113, 39.736762 ], [ -99.783325, 39.737818 ], [ -99.817657, 39.719863 ], [ -99.853363, 39.720920 ], [ -99.876709, 39.712469 ], [ -99.882202, 39.712469 ], [ -99.894562, 39.715638 ], [ -99.917908, 39.726201 ], [ -99.941254, 39.725145 ], [ -99.953613, 39.727257 ], [ -99.982452, 39.743098 ], [ -99.986572, 39.744154 ], [ -99.990692, 39.743098 ], [ -100.000305, 39.742042 ], [ -100.000305, 39.744154 ], [ -99.990692, 39.744154 ], [ -99.987946, 39.745210 ], [ -99.982452, 39.745210 ], [ -99.953613, 39.729370 ], [ -99.941254, 39.727257 ], [ -99.917908, 39.727257 ], [ -99.894562, 39.716694 ], [ -99.882202, 39.714582 ], [ -99.876709, 39.714582 ], [ -99.853363, 39.723032 ], [ -99.817657, 39.721976 ], [ -99.783325, 39.739930 ], [ -99.753113, 39.738874 ], [ -99.724274, 39.748378 ], [ -99.718781, 39.748378 ] ] ] } }
{ "type": "Feature", "properties": { "name": "R" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.718781, 39.748378 ], [ -99.706421, 39.746266 ], [ -99.683075, 39.735706 ], [ -99.654236, 39.735706 ], [ -99.618530, 39.718807 ], [ -99.607544, 39.718807 ], [ -99.584198, 39.721976 ], [ -99.553986, 39.715638 ], [ -99.542999, 39.718807 ], [ -99.519653, 39.731482 ], [ -99.489441, 39.731482 ], [ -99.478455, 39.735706 ], [ -99.460602, 39.745210 ], [ -99.448242, 39.747322 ], [ -99.419403, 39.740986 ], [ -99.396057, 39.744154 ], [ -99.383698, 39.743098 ], [ -99.354858, 39.727257 ], [ -99.343872, 39.725145 ], [ -99.320526, 39.726201 ], [ -99.295807, 39.715638 ], [ -99.295807, 39.713525 ], [ -99.320526, 39.724089 ], [ -99.343872, 39.723032 ], [ -99.354858, 39.725145 ], [ -99.383698, 39.740986 ], [ -99.396057, 39.742042 ], [ -99.419403, 39.738874 ], [ -99.448242, 39.746266 ], [ -99.460602, 39.743098 ], [ -99.478455, 39.733594 ], [ -99.489441, 39.729370 ], [ -99.519653, 39.729370 ], [ -99.542999, 39.717751 ], [ -99.553986, 39.713525 ], [ -99.584198, 39.719863 ], [ -99.607544, 39.716694 ], [ -99.618530, 39.716694 ], [ -99.654236, 39.734650 ], [ -99.683075, 39.733594 ], [ -99.706421, 39.744154 ], [ -99.718781, 39.747322 ], [ -99.724274, 39.746266 ], [ -99.753113, 39.736762 ], [ -99.783325, 39.737818 ], [ -99.817657, 39.719863 ], [ -99.853363, 39.720920 ], [ -99.876709, 39.712469 ], [ -99.882202, 39.712469 ], [ -99.894562, 39.715638 ], [ -99.917908, 39.726201 ], [ -99.941254, 39.725145 ], [ -99.953613, 39.727257 ], [ -99.982452, 39.743098 ], [ -99.986572, 39.744154 ], [ -99.990692, 39.743098 ], [ -100.000305, 39.742042 ], [ -100.000305, 39.743098 ], [ -100.000305, 39.744154 ], [ -99.990692, 39.744154 ], [ -99.987946, 39.745210 ], [ -99.982452, 39.745210 ], [ -99.953613, 39.729370 ], [ -99.941254, 39.727257 ], [ -99.917908, 39.727257 ], [ -99.894562, 39.716694 ], [ -99.882202, 39.714582 ], [ -99.876709, 39.714582 ], [ -99.853363, 39.723032 ], [ -99.817657, 39.721976 ], [ -99.783325, 39.739930 ], [ -99.753113, 39.738874 ], [ -99.724274, 39.748378 ], [ -99.718781, 39.748378 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "P" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -99.783325, 39.990799 ], [ -99.754486, 39.984486 ], [ -99.759979, 39.984486 ], [ -99.783325, 39.990799 ] ] ], [ [ [ -99.396057, 40.006580 ], [ -99.419403, 39.992904 ], [ -99.455109, 39.992904 ], [ -99.419403, 39.993956 ], [ -99.396057, 40.006580 ] ] ], [ [ [ -99.842377, 39.999216 ], [ -99.820404, 39.987643 ], [ -99.824524, 39.988695 ], [ -99.842377, 39.999216 ] ] ], [ [ [ -99.905548, 40.013943 ], [ -99.882202, 40.004476 ], [ -99.858856, 40.004476 ], [ -99.882202, 40.003424 ], [ -99.905548, 40.013943 ] ] ], [ [ [ -99.648743, 40.017098 ], [ -99.618530, 40.008683 ], [ -99.648743, 40.016046 ], [ -99.659729, 40.013943 ], [ -99.648743, 40.017098 ] ] ], [ [ [ -99.308167, 40.012891 ], [ -99.320526, 40.016046 ], [ -99.331512, 40.014994 ], [ -99.320526, 40.017098 ], [ -99.308167, 40.012891 ] ] ], [ [ [ -99.308167, 40.012891 ], [ -99.295807, 40.006580 ], [ -99.295807, 40.005528 ], [ -99.308167, 40.012891 ] ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.295807, 40.071766 ], [ -99.295807, 40.006580 ], [ -99.308167, 40.012891 ], [ -99.320526, 40.017098 ], [ -99.331512, 40.014994 ], [ -99.354858, 40.008683 ], [ -99.383698, 40.010787 ], [ -99.396057, 40.006580 ], [ -99.419403, 39.993956 ], [ -99.455109, 39.992904 ], [ -99.483948, 39.982382 ], [ -99.496307, 39.984486 ], [ -99.519653, 39.993956 ], [ -99.542999, 39.992904 ], [ -99.553986, 39.995008 ], [ -99.584198, 40.010787 ], [ -99.595184, 40.011839 ], [ -99.618530, 40.008683 ], [ -99.648743, 40.017098 ], [ -99.659729, 40.013943 ], [ -99.683075, 40.002372 ], [ -99.718781, 40.000268 ], [ -99.742126, 39.987643 ], [ -99.753113, 39.984486 ], [ -99.783325, 39.990799 ], [ -99.806671, 39.986591 ], [ -99.817657, 39.986591 ], [ -99.847870, 40.002372 ], [ -99.858856, 40.004476 ], [ -99.882202, 40.004476 ], [ -99.905548, 40.013943 ], [ -99.917908, 40.017098 ], [ -99.953613, 40.007632 ], [ -99.982452, 40.008683 ], [ -100.000305, 40.000268 ], [ -100.000305, 40.071766 ], [ -99.295807, 40.071766 ] ] ] } }
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.295807, 40.071766 ], [ -99.295807, 40.006580 ], [ -99.308167, 40.012891 ], [ -99.320526, 40.017098 ], [ -99.331512, 40.014994 ], [ -99.354858, 40.008683 ], [ -99.383698, 40.010787 ], [ -99.396057, 40.006580 ], [ -99.419403, 39.993956 ], [ -99.455109, 39.992904 ], [ -99.483948, 39.982382 ], [ -99.496307, 39.984486 ], [ -99.519653, 39.993956 ], [ -99.542999, 39.992904 ], [ -99.553986, 39.995008 ], [ -99.584198, 40.010787 ], [ -99.595184, 40.011839 ], [ -99.618530, 40.008683 ], [ -99.648743, 40.017098 ], [ -99.659729, 40.013943 ], [ -99.683075, 40.002372 ], [ -99.718781, 40.000268 ], [ -99.742126, 39.987643 ], [ -99.744873, 39.986591 ], [ -99.747620, 39.985538 ], [ -99.750366, 39.985538 ], [ -99.753113, 39.984486 ], [ -99.754486, 39.984486 ], [ -99.783325, 39.990799 ], [ -99.806671, 39.986591 ], [ -99.812164, 39.986591 ], [ -99.817657, 39.986591 ], [ -99.820404, 39.987643 ], [ -99.842377, 39.999216 ], [ -99.847870, 40.002372 ], [ -99.849243, 40.002372 ], [ -99.857483, 40.004476 ], [ -99.858856, 40.004476 ], [ -99.882202, 40.004476 ], [ -99.905548, 40.013943 ], [ -99.909668, 40.014994 ], [ -99.912415, 40.016046 ], [ -99.915161, 40.016046 ], [ -99.917908, 40.017098 ], [ -99.919281, 40.017098 ], [ -99.953613, 40.007632 ], [ -99.982452, 40.008683 ], [ -100.000305, 40.000268 ], [ -100.000305, 40.071766 ], [ -99.295807, 40.071766 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.923401, 40.017098 ], [ -99.912415, 40.016046 ], [ -99.882202, 40.003424 ], [ -99.853363, 40.004476 ], [ -99.842377, 39.999216 ], [ -99.824524, 39.988695 ], [ -99.812164, 39.986591 ], [ -99.783325, 39.990799 ], [ -99.759979, 39.984486 ], [ -99.747620, 39.985538 ], [ -99.718781, 40.000268 ], [ -99.683075, 40.002372 ], [ -99.659729, 40.013943 ], [ -99.648743, 40.016046 ], [ -99.618530, 40.008683 ], [ -99.595184, 40.011839 ], [ -99.584198, 40.010787 ], [ -99.553986, 39.995008 ], [ -99.542999, 39.992904 ], [ -99.519653, 39.993956 ], [ -99.496307, 39.984486 ], [ -99.483948, 39.982382 ], [ -99.455109, 39.992904 ], [ -99.419403, 39.992904 ], [ -99.396057, 40.006580 ], [ -99.383698, 40.010787 ], [ -99.354858, 40.008683 ], [ -99.331512, 40.014994 ], [ -99.320526, 40.016046 ], [ -99.308167, 40.012891 ], [ -99.295807, 40.005528 ], [ -99.295807, 39.927642 ], [ -100.000305, 39.927642 ], [ -100.000305, 40.000268 ], [ -99.982452, 40.008683 ], [ -99.953613, 40.007632 ], [ -99.923401, 40.017098 ] ] ] } }
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.923401, 40.017098 ], [ -99.919281, 40.017098 ], [ -99.917908, 40.017098 ], [ -99.915161, 40.016046 ], [ -99.912415, 40.016046 ], [ -99.909668, 40.014994 ], [ -99.905548, 40.013943 ], [ -99.882202, 40.003424 ], [ -99.858856, 40.004476 ], [ -99.857483, 40.004476 ], [ -99.853363, 40.004476 ], [ -99.849243, 40.002372 ], [ -99.847870, 40.002372 ], [ -99.842377, 39.999216 ], [ -99.824524, 39.988695 ], [ -99.820404, 39.987643 ], [ -99.812164, 39.986591 ], [ -99.783325, 39.990799 ], [ -99.759979, 39.984486 ], [ -99.754486, 39.984486 ], [ -99.753113, 39.984486 ], [ -99.750366, 39.985538 ], [ -99.747620, 39.985538 ], [ -99.744873, 39.986591 ], [ -99.742126, 39.987643 ], [ -99.718781, 40.000268 ], [ -99.683075, 40.002372 ], [ -99.659729, 40.013943 ], [ -99.648743, 40.016046 ], [ -99.618530, 40.008683 ], [ -99.595184, 40.011839 ], [ -99.584198, 40.010787 ], [ -99.553986, 39.995008 ], [ -99.542999, 39.992904 ], [ -99.519653, 39.993956 ], [ -99.496307, 39.984486 ], [ -99.483948, 39.982382 ], [ -99.455109, 39.992904 ], [ -99.419403, 39.992904 ], [ -99.396057, 40.006580 ], [ -99.383698, 40.010787 ], [ -99.354858, 40.008683 ], [ -99.331512, 40.014994 ], [ -99.320526, 40.016046 ], [ -99.308167, 40.012891 ], [ -99.295807, 40.005528 ], [ -99.295807, 39.927642 ], [ -100.000305, 39.927642 ], [ -100.000305, 40.000268 ], [ -99.982452, 40.008683 ], [ -99.953613, 40.007632 ], [ -99.923401, 40.017098 ] ] ] } }
] }
] }
,
@@ -125,9 +125,9 @@
,
{ "type": "Feature", "properties": { "name": "P" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -99.642563, 40.015520 ], [ -99.624710, 40.010261 ], [ -99.619217, 40.009209 ], [ -99.613037, 40.009209 ], [ -99.595184, 40.012365 ], [ -99.589691, 40.012365 ], [ -99.583511, 40.011313 ], [ -99.578018, 40.008683 ], [ -99.583511, 40.010787 ], [ -99.589691, 40.011839 ], [ -99.595184, 40.011839 ], [ -99.613037, 40.008683 ], [ -99.619217, 40.008683 ], [ -99.624710, 40.009735 ], [ -99.642563, 40.015520 ] ] ], [ [ [ -99.718781, 40.000268 ], [ -99.724274, 39.997638 ], [ -99.742126, 39.987643 ], [ -99.747620, 39.985538 ], [ -99.742126, 39.988169 ], [ -99.724274, 39.998164 ], [ -99.718781, 40.000268 ] ] ], [ [ [ -99.917908, 40.017624 ], [ -99.911728, 40.016572 ], [ -99.906235, 40.014468 ], [ -99.888382, 40.006054 ], [ -99.882889, 40.003950 ], [ -99.888382, 40.005528 ], [ -99.911728, 40.016046 ], [ -99.917908, 40.017098 ], [ -99.924088, 40.016572 ], [ -99.941254, 40.009735 ], [ -99.952927, 40.007106 ], [ -99.976273, 40.009735 ], [ -99.952927, 40.007632 ], [ -99.941254, 40.010261 ], [ -99.924088, 40.017098 ], [ -99.917908, 40.017624 ] ] ], [ [ [ -99.490128, 39.982908 ], [ -99.483948, 39.982908 ], [ -99.478455, 39.983960 ], [ -99.454422, 39.993430 ], [ -99.442749, 39.993956 ], [ -99.425583, 39.992378 ], [ -99.442749, 39.993430 ], [ -99.454422, 39.992904 ], [ -99.478455, 39.983434 ], [ -99.483948, 39.982382 ], [ -99.490128, 39.982908 ] ] ], [ [ [ -99.806671, 39.987117 ], [ -99.788818, 39.990799 ], [ -99.783325, 39.990799 ], [ -99.759293, 39.985012 ], [ -99.753799, 39.984486 ], [ -99.759293, 39.984486 ], [ -99.783325, 39.990273 ], [ -99.788818, 39.990273 ], [ -99.806671, 39.987117 ] ] ], [ [ [ -99.378204, 40.011313 ], [ -99.384384, 40.010787 ], [ -99.389877, 40.009209 ], [ -99.396057, 40.006580 ], [ -99.389877, 40.009735 ], [ -99.384384, 40.011313 ], [ -99.378204, 40.011313 ] ] ], [ [ [ -99.976273, 40.009735 ], [ -99.982452, 40.008683 ], [ -99.987946, 40.006580 ], [ -100.000305, 39.999742 ], [ -100.000305, 40.000268 ], [ -99.987946, 40.007106 ], [ -99.982452, 40.009209 ], [ -99.976273, 40.009735 ] ] ], [ [ [ -99.859543, 40.005002 ], [ -99.853363, 40.004476 ], [ -99.847870, 40.002372 ], [ -99.843063, 39.999742 ], [ -99.853363, 40.003950 ], [ -99.859543, 40.004476 ], [ -99.876709, 40.003424 ], [ -99.859543, 40.005002 ] ] ], [ [ [ -99.548492, 39.993430 ], [ -99.542999, 39.993430 ], [ -99.525146, 39.995008 ], [ -99.518967, 39.994482 ], [ -99.513474, 39.992378 ], [ -99.518967, 39.993956 ], [ -99.525146, 39.994482 ], [ -99.542999, 39.992904 ], [ -99.548492, 39.993430 ] ] ], [ [ [ -99.806671, 39.987117 ], [ -99.812164, 39.986065 ], [ -99.818344, 39.986591 ], [ -99.823837, 39.988695 ], [ -99.836197, 39.996060 ], [ -99.823837, 39.989221 ], [ -99.818344, 39.987117 ], [ -99.812164, 39.986591 ], [ -99.806671, 39.987117 ] ] ], [ [ [ -99.659729, 40.013943 ], [ -99.683075, 40.001846 ], [ -99.689255, 40.000794 ], [ -99.683075, 40.002372 ], [ -99.659729, 40.013943 ] ] ], [ [ [ -99.319839, 40.016572 ], [ -99.313660, 40.015520 ], [ -99.308167, 40.012891 ], [ -99.296494, 40.006054 ], [ -99.308167, 40.012365 ], [ -99.313660, 40.014994 ], [ -99.319839, 40.016572 ] ] ], [ [ [ -99.396057, 40.006580 ], [ -99.413910, 39.995534 ], [ -99.419403, 39.993430 ], [ -99.413910, 39.996060 ], [ -99.396057, 40.006580 ] ] ], [ [ [ -99.349365, 40.009209 ], [ -99.331512, 40.015520 ], [ -99.326019, 40.016572 ], [ -99.331512, 40.014994 ], [ -99.349365, 40.009209 ] ] ], [ [ [ -99.642563, 40.015520 ], [ -99.648056, 40.016046 ], [ -99.654236, 40.015520 ], [ -99.659729, 40.013943 ], [ -99.654236, 40.016046 ], [ -99.648056, 40.016572 ], [ -99.642563, 40.015520 ] ] ], [ [ [ -99.349365, 40.009209 ], [ -99.354858, 40.008158 ], [ -99.361038, 40.008683 ], [ -99.354858, 40.008683 ], [ -99.349365, 40.009209 ] ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.296494, 40.071766 ], [ -99.296494, 40.006054 ], [ -99.308167, 40.012891 ], [ -99.313660, 40.015520 ], [ -99.319839, 40.016572 ], [ -99.326019, 40.016572 ], [ -99.331512, 40.015520 ], [ -99.349365, 40.009209 ], [ -99.354858, 40.008683 ], [ -99.361038, 40.008683 ], [ -99.378204, 40.011313 ], [ -99.384384, 40.011313 ], [ -99.389877, 40.009735 ], [ -99.396057, 40.006580 ], [ -99.413910, 39.996060 ], [ -99.419403, 39.993430 ], [ -99.425583, 39.992378 ], [ -99.442749, 39.993956 ], [ -99.454422, 39.993430 ], [ -99.478455, 39.983960 ], [ -99.483948, 39.982908 ], [ -99.490128, 39.982908 ], [ -99.495621, 39.984486 ], [ -99.513474, 39.992378 ], [ -99.518967, 39.994482 ], [ -99.525146, 39.995008 ], [ -99.542999, 39.993430 ], [ -99.548492, 39.993430 ], [ -99.554672, 39.995008 ], [ -99.560165, 39.997638 ], [ -99.578018, 40.008683 ], [ -99.583511, 40.011313 ], [ -99.589691, 40.012365 ], [ -99.595184, 40.012365 ], [ -99.613037, 40.009209 ], [ -99.619217, 40.009209 ], [ -99.624710, 40.010261 ], [ -99.642563, 40.015520 ], [ -99.648056, 40.016572 ], [ -99.654236, 40.016046 ], [ -99.659729, 40.013943 ], [ -99.683075, 40.002372 ], [ -99.689255, 40.000794 ], [ -99.712601, 40.001320 ], [ -99.718781, 40.000268 ], [ -99.724274, 39.998164 ], [ -99.742126, 39.988169 ], [ -99.747620, 39.985538 ], [ -99.753799, 39.984486 ], [ -99.759293, 39.985012 ], [ -99.783325, 39.990799 ], [ -99.788818, 39.990799 ], [ -99.806671, 39.987117 ], [ -99.812164, 39.986591 ], [ -99.818344, 39.987117 ], [ -99.823837, 39.989221 ], [ -99.847870, 40.002372 ], [ -99.853363, 40.004476 ], [ -99.859543, 40.005002 ], [ -99.876709, 40.003424 ], [ -99.882889, 40.003950 ], [ -99.888382, 40.006054 ], [ -99.906235, 40.014468 ], [ -99.911728, 40.016572 ], [ -99.917908, 40.017624 ], [ -99.924088, 40.017098 ], [ -99.941254, 40.010261 ], [ -99.952927, 40.007632 ], [ -99.976273, 40.009735 ], [ -99.982452, 40.009209 ], [ -99.987946, 40.007106 ], [ -100.000305, 40.000268 ], [ -100.000305, 40.071766 ], [ -99.296494, 40.071766 ] ] ] } }
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.296494, 40.071766 ], [ -99.296494, 40.006054 ], [ -99.308167, 40.012891 ], [ -99.313660, 40.015520 ], [ -99.319839, 40.016572 ], [ -99.326019, 40.016572 ], [ -99.331512, 40.015520 ], [ -99.349365, 40.009209 ], [ -99.354858, 40.008683 ], [ -99.361038, 40.008683 ], [ -99.378204, 40.011313 ], [ -99.384384, 40.011313 ], [ -99.389877, 40.009735 ], [ -99.396057, 40.006580 ], [ -99.413910, 39.996060 ], [ -99.419403, 39.993430 ], [ -99.425583, 39.992378 ], [ -99.442749, 39.993956 ], [ -99.454422, 39.993430 ], [ -99.478455, 39.983960 ], [ -99.483948, 39.982908 ], [ -99.490128, 39.982908 ], [ -99.495621, 39.984486 ], [ -99.513474, 39.992378 ], [ -99.518967, 39.994482 ], [ -99.525146, 39.995008 ], [ -99.542999, 39.993430 ], [ -99.548492, 39.993430 ], [ -99.554672, 39.995008 ], [ -99.560165, 39.997638 ], [ -99.578018, 40.008683 ], [ -99.583511, 40.011313 ], [ -99.589691, 40.012365 ], [ -99.595184, 40.012365 ], [ -99.613037, 40.009209 ], [ -99.619217, 40.009209 ], [ -99.624710, 40.010261 ], [ -99.642563, 40.015520 ], [ -99.648056, 40.016572 ], [ -99.654236, 40.016046 ], [ -99.659729, 40.013943 ], [ -99.683075, 40.002372 ], [ -99.689255, 40.000794 ], [ -99.712601, 40.001320 ], [ -99.718781, 40.000268 ], [ -99.724274, 39.998164 ], [ -99.742126, 39.988169 ], [ -99.747620, 39.985538 ], [ -99.753799, 39.984486 ], [ -99.759293, 39.985012 ], [ -99.783325, 39.990799 ], [ -99.788818, 39.990799 ], [ -99.806671, 39.987117 ], [ -99.812164, 39.986591 ], [ -99.818344, 39.987117 ], [ -99.823837, 39.989221 ], [ -99.836197, 39.996060 ], [ -99.841690, 39.999216 ], [ -99.843063, 39.999742 ], [ -99.847870, 40.002372 ], [ -99.853363, 40.004476 ], [ -99.859543, 40.005002 ], [ -99.876709, 40.003424 ], [ -99.882889, 40.003950 ], [ -99.888382, 40.006054 ], [ -99.906235, 40.014468 ], [ -99.911728, 40.016572 ], [ -99.917908, 40.017624 ], [ -99.924088, 40.017098 ], [ -99.941254, 40.010261 ], [ -99.952927, 40.007632 ], [ -99.976273, 40.009735 ], [ -99.982452, 40.009209 ], [ -99.987946, 40.007106 ], [ -100.000305, 40.000268 ], [ -100.000305, 40.071766 ], [ -99.296494, 40.071766 ] ] ] } }
,
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.917908, 40.017098 ], [ -99.911728, 40.016046 ], [ -99.888382, 40.005528 ], [ -99.882889, 40.003950 ], [ -99.876709, 40.003424 ], [ -99.859543, 40.004476 ], [ -99.853363, 40.003950 ], [ -99.841690, 39.999216 ], [ -99.823837, 39.988695 ], [ -99.818344, 39.986591 ], [ -99.812164, 39.986065 ], [ -99.788818, 39.990273 ], [ -99.783325, 39.990273 ], [ -99.759293, 39.984486 ], [ -99.753799, 39.984486 ], [ -99.747620, 39.985538 ], [ -99.742126, 39.987643 ], [ -99.724274, 39.997638 ], [ -99.718781, 40.000268 ], [ -99.712601, 40.001320 ], [ -99.689255, 40.000794 ], [ -99.683075, 40.001846 ], [ -99.659729, 40.013943 ], [ -99.654236, 40.015520 ], [ -99.648056, 40.016046 ], [ -99.642563, 40.015520 ], [ -99.624710, 40.009735 ], [ -99.619217, 40.008683 ], [ -99.613037, 40.008683 ], [ -99.595184, 40.011839 ], [ -99.589691, 40.011839 ], [ -99.583511, 40.010787 ], [ -99.578018, 40.008683 ], [ -99.560165, 39.997638 ], [ -99.554672, 39.995008 ], [ -99.548492, 39.993430 ], [ -99.542999, 39.992904 ], [ -99.525146, 39.994482 ], [ -99.518967, 39.993956 ], [ -99.513474, 39.992378 ], [ -99.495621, 39.984486 ], [ -99.490128, 39.982908 ], [ -99.483948, 39.982382 ], [ -99.478455, 39.983434 ], [ -99.454422, 39.992904 ], [ -99.442749, 39.993430 ], [ -99.425583, 39.992378 ], [ -99.419403, 39.993430 ], [ -99.413910, 39.995534 ], [ -99.396057, 40.006580 ], [ -99.389877, 40.009209 ], [ -99.384384, 40.010787 ], [ -99.378204, 40.011313 ], [ -99.361038, 40.008683 ], [ -99.354858, 40.008158 ], [ -99.349365, 40.009209 ], [ -99.331512, 40.014994 ], [ -99.326019, 40.016572 ], [ -99.319839, 40.016572 ], [ -99.313660, 40.014994 ], [ -99.308167, 40.012365 ], [ -99.296494, 40.006054 ], [ -99.296494, 39.928168 ], [ -100.000305, 39.928168 ], [ -100.000305, 39.999742 ], [ -99.987946, 40.006580 ], [ -99.982452, 40.008683 ], [ -99.976273, 40.009735 ], [ -99.952927, 40.007106 ], [ -99.941254, 40.009735 ], [ -99.924088, 40.016572 ], [ -99.917908, 40.017098 ] ] ] } }
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.917908, 40.017098 ], [ -99.911728, 40.016046 ], [ -99.888382, 40.005528 ], [ -99.882889, 40.003950 ], [ -99.876709, 40.003424 ], [ -99.859543, 40.004476 ], [ -99.853363, 40.003950 ], [ -99.843063, 39.999742 ], [ -99.841690, 39.999216 ], [ -99.836197, 39.996060 ], [ -99.823837, 39.988695 ], [ -99.818344, 39.986591 ], [ -99.812164, 39.986065 ], [ -99.806671, 39.987117 ], [ -99.788818, 39.990273 ], [ -99.783325, 39.990273 ], [ -99.759293, 39.984486 ], [ -99.753799, 39.984486 ], [ -99.747620, 39.985538 ], [ -99.742126, 39.987643 ], [ -99.724274, 39.997638 ], [ -99.718781, 40.000268 ], [ -99.712601, 40.001320 ], [ -99.689255, 40.000794 ], [ -99.683075, 40.001846 ], [ -99.659729, 40.013943 ], [ -99.654236, 40.015520 ], [ -99.648056, 40.016046 ], [ -99.642563, 40.015520 ], [ -99.624710, 40.009735 ], [ -99.619217, 40.008683 ], [ -99.613037, 40.008683 ], [ -99.595184, 40.011839 ], [ -99.589691, 40.011839 ], [ -99.583511, 40.010787 ], [ -99.578018, 40.008683 ], [ -99.560165, 39.997638 ], [ -99.554672, 39.995008 ], [ -99.548492, 39.993430 ], [ -99.542999, 39.992904 ], [ -99.525146, 39.994482 ], [ -99.518967, 39.993956 ], [ -99.513474, 39.992378 ], [ -99.495621, 39.984486 ], [ -99.490128, 39.982908 ], [ -99.483948, 39.982382 ], [ -99.478455, 39.983434 ], [ -99.454422, 39.992904 ], [ -99.442749, 39.993430 ], [ -99.425583, 39.992378 ], [ -99.419403, 39.993430 ], [ -99.413910, 39.995534 ], [ -99.396057, 40.006580 ], [ -99.389877, 40.009209 ], [ -99.384384, 40.010787 ], [ -99.378204, 40.011313 ], [ -99.361038, 40.008683 ], [ -99.354858, 40.008158 ], [ -99.349365, 40.009209 ], [ -99.331512, 40.014994 ], [ -99.326019, 40.016572 ], [ -99.319839, 40.016572 ], [ -99.313660, 40.014994 ], [ -99.308167, 40.012365 ], [ -99.296494, 40.006054 ], [ -99.296494, 39.928168 ], [ -100.000305, 39.928168 ], [ -100.000305, 39.999742 ], [ -99.987946, 40.006580 ], [ -99.982452, 40.008683 ], [ -99.976273, 40.009735 ], [ -99.952927, 40.007106 ], [ -99.941254, 40.009735 ], [ -99.924088, 40.016572 ], [ -99.917908, 40.017098 ] ] ] } }
] }
] }
] }
+112 -34
View File
@@ -530,6 +530,15 @@ static void rewrite(serial_feature const &osf, int z, int nextzoom, int maxzoom,
}
}
// What the first pass of simplification (simplifying and rounding a feature)
// leaves for the second pass (cleaning it) to use
struct simplified_feature {
double area = 0; // in world coordinates, before simplification
drawvec strips; // spindle strips to union with the cleaned polygon
drawvec world; // the polygon as simplified, but before rounding
bool gridded = false; // stairstepped onto a grid
};
// This is the parameter block passed to each simplification worker thread
struct simplification_worker_arg {
std::vector<std::shared_ptr<serial_feature>> *features = NULL;
@@ -540,6 +549,14 @@ struct simplification_worker_arg {
node *shared_nodes_map;
size_t nodepos;
std::string const *shared_nodes_bloom;
// 0: simplify, round, and clean each feature.
// 1: only simplify and round, leaving the rest in `simplified`.
// 2: only clean, snapping to the hot pixels of the feature's layer
// in `layer_hot_pixels`, so that shared edges snap consistently.
int pass = 0;
std::vector<simplified_feature> *simplified = NULL;
std::map<long long, hot_pixel_list> const *layer_hot_pixels = NULL;
};
// If a polygon has collapsed away to nothing during polygon cleaning,
@@ -668,52 +685,80 @@ static void *simplification_worker(void *v) {
std::vector<std::shared_ptr<serial_feature>> *features = a->features;
for (size_t i = a->task; i < (*features).size(); i += a->tasks) {
double area = 0;
area = simplify_feature(&*((*features)[i]), *(a->shared_nodes), a->shared_nodes_map, a->nodepos, *(a->shared_nodes_bloom));
signed char t = (*features)[i]->t;
int z = (*features)[i]->z;
int out_detail = (*features)[i]->extra_detail;
// stairstepped onto a grid, which strips would not follow
bool gridded = additional[A_GRID_LOW_ZOOMS] && z < (*features)[i]->maxzoom;
simplified_feature local;
simplified_feature &sf = (a->simplified != NULL) ? (*a->simplified)[i] : local;
if (a->pass != 2) {
sf.area = simplify_feature(&*((*features)[i]), *(a->shared_nodes), a->shared_nodes_map, a->nodepos, *(a->shared_nodes_bloom));
// stairstepped onto a grid, which strips would not follow
sf.gridded = additional[A_GRID_LOW_ZOOMS] && z < (*features)[i]->maxzoom;
drawvec geom = (*features)[i]->geometry;
// Before rounding to tile coordinates, find any parts of the polygon
// that are too narrow to survive the rounding, so they can be
// restored as one-pixel-wide strips after cleaning.
// (Not when the geometry has been stairstepped onto a grid, which the strips would not follow.)
if (t == VT_POLYGON && !prevent[P_SPINDLES] && !sf.gridded) {
sf.strips = thin_polygon_strips(geom, z, out_detail, (*features)[i]->simplification,
(long long) (*features)[i]->tx << (32 - z), (long long) (*features)[i]->ty << (32 - z));
}
// The polygon as simplified but before rounding, in case it collapses
// entirely and needs to be replaced by something shaped like it
// (which is part of spindle preservation, so not if that is turned off)
if (t == VT_POLYGON && !sf.gridded && !prevent[P_SPINDLES]) {
sf.world = geom;
}
to_tile_scale(geom, z, out_detail);
(*features)[i]->geometry = std::move(geom);
if (a->pass == 1) {
continue;
}
}
drawvec geom = (*features)[i]->geometry;
// Before rounding to tile coordinates, find any parts of the polygon
// that are too narrow to survive the rounding, so they can be
// restored as one-pixel-wide strips after cleaning.
drawvec strips;
// (Not when the geometry has been stairstepped onto a grid, which the strips would not follow.)
if (t == VT_POLYGON && !prevent[P_SPINDLES] && !gridded) {
strips = thin_polygon_strips(geom, z, out_detail, (*features)[i]->simplification,
(long long) (*features)[i]->tx << (32 - z), (long long) (*features)[i]->ty << (32 - z));
}
// The polygon as simplified but before rounding, in case it collapses
// entirely and needs to be replaced by something shaped like it
// (which is part of spindle preservation, so not if that is turned off)
drawvec world;
if (t == VT_POLYGON && !gridded && !prevent[P_SPINDLES]) {
world = geom;
}
to_tile_scale(geom, z, out_detail);
if (t == VT_POLYGON) {
// Scaling may have made the polygon degenerate.
// Give Clipper a chance to try to fix it.
{
drawvec before = geom;
// we can try scaling up because this is now tile scale
coalesce_polygon(geom, true);
geom = union_polygon_strips(geom, strips);
// If there is a set of hot pixels for the whole layer, snap to them
// so that edges shared with other features are snapped identically.
hot_pixel_list const *hot = NULL;
if (a->layer_hot_pixels != NULL) {
auto found = a->layer_hot_pixels->find((*features)[i]->layer);
if (found != a->layer_hot_pixels->end()) {
hot = &found->second;
}
}
bool cleaned = false;
if (hot != NULL && geom.size() < 100000) {
geom = clean_polygon_with_hot_pixels(before, *hot, &cleaned);
if (!cleaned) {
geom = before;
}
}
if (!cleaned) {
// we can try scaling up because this is now tile scale
coalesce_polygon(geom, true);
}
geom = union_polygon_strips(geom, sf.strips, hot);
if (additional[A_DEBUG_POLYGON]) {
check_polygon(geom);
}
if (geom.size() < 3) {
if (area > 0) {
if (sf.area > 0) {
// Replace the polygon with a line one pixel wide along its outline,
// which keeps its shape and location. Only if that too is empty,
// because the whole polygon is within a pixel or so, fall back to
@@ -724,16 +769,16 @@ static void *simplification_worker(void *v) {
// so that its neighbors close over the space without overlapping.
geom.clear();
bool all_shared = false;
if (world.size() > 0) {
geom = union_polygon_strips(drawvec(), outline_strips(world, z, out_detail, (*features)[i]->simplification,
(long long) (*features)[i]->tx << (32 - z), (long long) (*features)[i]->ty << (32 - z), &all_shared));
if (sf.world.size() > 0) {
geom = union_polygon_strips(drawvec(), outline_strips(sf.world, z, out_detail, (*features)[i]->simplification,
(long long) (*features)[i]->tx << (32 - z), (long long) (*features)[i]->ty << (32 - z), &all_shared));
}
if (geom.size() < 3) {
if (all_shared) {
geom.clear();
} else {
// area is in world coordinates, calculated before scaling down
geom = revive_polygon(before, area, z, out_detail);
geom = revive_polygon(before, sf.area, z, out_detail);
}
}
} else {
@@ -747,6 +792,9 @@ static void *simplification_worker(void *v) {
(*features)[i]->index = i;
}
(*features)[i]->geometry = std::move(geom);
// The intermediate state is no longer needed
sf = simplified_feature();
}
return NULL;
@@ -2517,7 +2565,30 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
tasks = 1;
}
{
// With --no-simplification-of-shared-nodes, features that share borders are
// meant to tile exactly, so after they have all been simplified and rounded,
// find the hot pixels of all the polygons in each layer, so that each polygon
// can be snapped to them and the borders they share are snapped identically.
bool consistent_snapping = prevent[P_SIMPLIFY_SHARED_NODES];
std::vector<simplified_feature> simplified;
std::map<long long, hot_pixel_list> hot_pixels_by_layer;
if (consistent_snapping) {
simplified.resize(features.size());
}
for (int snap_pass = consistent_snapping ? 1 : 0; snap_pass <= (consistent_snapping ? 2 : 0); snap_pass++) {
if (snap_pass == 2) {
std::map<long long, std::vector<drawvec const *>> layer_polygons;
for (auto const &f : features) {
if (f->t == VT_POLYGON) {
layer_polygons[f->layer].push_back(&f->geometry);
}
}
for (auto const &lp : layer_polygons) {
hot_pixels_by_layer[lp.first] = layer_hot_pixels(lp.second);
}
}
std::vector<pthread_t> pthreads(tasks);
std::vector<simplification_worker_arg> args;
args.resize(tasks);
@@ -2529,6 +2600,13 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
args[i].shared_nodes_map = shared_nodes_map;
args[i].nodepos = nodepos;
args[i].shared_nodes_bloom = &shared_nodes_bloom;
args[i].pass = snap_pass;
if (consistent_snapping) {
args[i].simplified = &simplified;
}
if (snap_pass == 2) {
args[i].layer_hot_pixels = &hot_pixels_by_layer;
}
if (tasks > 1) {
if (thread_create(&pthreads[i], NULL, simplification_worker, &args[i]) != 0) {
+61
View File
@@ -695,3 +695,64 @@ TEST_CASE("A polygon that collapses entirely can be replaced by its outline", "[
REQUIRE(miny >= 99);
REQUIRE(maxy <= 601);
}
TEST_CASE("Snapping to a layer's hot pixels keeps shared borders consistent", "[wagyu]") {
// A Census block (rounded to tile coordinates) and the sliver beside it,
// which share a long diagonal border. Rounding moved one of the block's
// own vertices across that border, so cleaning the block on its own snaps
// its copy of the border through a hot pixel that the sliver doesn't have,
// leaving a gap between them.
auto ring = [](std::vector<std::pair<long long, long long>> pts) {
drawvec g;
for (size_t i = 0; i < pts.size(); i++) {
g.push_back(draw(i == 0 ? VT_MOVETO : VT_LINETO, pts[i].first, pts[i].second));
}
return g;
};
drawvec sliver = ring({{227, 197}, {228, 197}, {235, 226}, {235, 226}, {227, 197}});
drawvec block = ring({{241, 226}, {235, 226}, {228, 197}, {230, 197}, {229, 199}, {229, 202}, {231, 207}, {234, 208}, {234, 213}, {235, 218}, {238, 223}, {241, 224}, {241, 226}});
drawvec both = sliver;
both.insert(both.end(), block.begin(), block.end());
drawvec together = clean_or_clip_poly(both, 0, 0, false, false);
// Count the pixels covered by the two cleaned together that neither covers
// when cleaned separately, and the pixels that both cover
auto shards = [&](drawvec const &a, drawvec const &b, int *gaps, int *overlaps) {
auto x2 = [](drawvec g) {
for (auto &d : g) {
d.x *= 2;
d.y *= 2;
}
return g;
};
drawvec u2 = x2(together), a2 = x2(a), b2 = x2(b);
*gaps = *overlaps = 0;
for (long long y = 190; y < 230; y++) {
for (long long x = 220; x < 245; x++) {
int n = pnpoly_mp(a2, 2 * x + 1, 2 * y + 1) + pnpoly_mp(b2, 2 * x + 1, 2 * y + 1);
if (n == 0 && pnpoly_mp(u2, 2 * x + 1, 2 * y + 1)) {
(*gaps)++;
}
if (n > 1) {
(*overlaps)++;
}
}
}
};
drawvec s1 = sliver, b1 = block;
int gaps, overlaps;
shards(clean_or_clip_poly(s1, 0, 0, false, false), clean_or_clip_poly(b1, 0, 0, false, false), &gaps, &overlaps);
REQUIRE(gaps > 0);
hot_pixel_list hot = layer_hot_pixels({&sliver, &block});
bool ok1, ok2;
drawvec s2 = clean_polygon_with_hot_pixels(sliver, hot, &ok1);
drawvec b2 = clean_polygon_with_hot_pixels(block, hot, &ok2);
REQUIRE(ok1);
REQUIRE(ok2);
shards(s2, b2, &gaps, &overlaps);
REQUIRE(gaps == 0);
REQUIRE(overlaps == 0);
}