Fix definition of overlaps for boundaries #354
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For boundary geometries, we want to include the row in the result of a query when some part of its boundary is inside the bounding box. Originally, we used
st_intersects
for this, but it had the problem that it would include rows which had very large (and complex) boundaries for tiles which were completely in the interior of the polygon, which led to unnecessary data being returned and processed.In tilezen/vector-datasource#1116, a new
bbox_overlaps
test was added, usingst_overlaps
. This no longer included polygons for which the tile bounding box was entirely with the interior. However, it also didn't include polygons which were themselves entirely within the interior of the bounding box, which meant some small countries (e.g: Liechtenstein) went missing at some zoom levels!This patch changes the definition of the
bbox_overlaps
test to also include polygons contained by the tile bounding box.