This repository was archived by the owner on Jan 10, 2019. It is now read-only.
This repository was archived by the owner on Jan 10, 2019. It is now read-only.
Rectangle that intersects with four children doesn't mean it covers all its children #12
Open
Description
This snippet of code is problematic:
if (children.size() == 1 || children.size() == 2) {
for (S2CellId child : children) {
if (child.isLeaf()) {
cellIds.add(child);
} else {
queue.add(child);
}
}
} else if (children.size() == 3) {
cellIds.addAll(children);
} else if (children.size() == 4) {
cellIds.add(parent);
} else {
assert false; // This should not happen.
}
Image the situation that the rectangle is located near the center of the parent but isn't large enough to cover it, then it can still intersect with all its children.
The right way to do is to first check whether the rectangle contains the parent, and add all its intersected children to the queue.
Example bounds: (46.95913069858797, -123.74038696289062, 48.055558949569566, -121.27670288085938). Queries also returns points in Spokane.
Metadata
Metadata
Assignees
Labels
No labels