Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GeoPolygonFilter to handle polygons crossing the dateline #9339

Merged
merged 1 commit into from Jan 27, 2015

Conversation

nknize
Copy link
Contributor

@nknize nknize commented Jan 16, 2015

PR #8672 addresses ambiguous polygons - those that either cross the dateline or span the map - by complying with the OGC standard right-hand rule. Since GeoPolygonFilter is self contained logic, the fix in #8672 did not address the issue for the GeoPolygonFilter. This was identified in issue #5968

This fixes the ambiguous polygon issue in GeoPolygonFilter by moving the dateline crossing code from ShapeBuilder to GeoUtils and reusing the logic inside the pointInPolygon method. Unit tests are added to ensure support for coordinates specified in either standard lat/lon or great-circle coordinate systems.

closes #5968
closes #9304

}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (o == null) return false;
if (o instanceof Coordinate) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this be true for any GeoPoint, so you can never reach the block casting to GeoPoint?

@rjernst
Copy link
Member

rjernst commented Jan 21, 2015

@nknize I left some comments.

@clintongormley
Copy link

@rjernst please could you give another review

return (points[prev].x > points[next].x);
}

private static final int computePolyTop(GeoPoint[] points, int length) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i still feel like we should make this function name "correct" and maybe call it "computePolyBottomLeft"?

@rjernst
Copy link
Member

rjernst commented Jan 27, 2015

LGTM. I also think having dedicated unit tests for the utility methods in GeoUtils would be good, but what is here does not make anything worse (just moves existing code around).

PR elastic#8672 addresses ambiguous polygons - those that either cross the dateline or span the map - by complying with the OGC standard right-hand rule. Since ```GeoPolygonFilter``` is self contained logic, the fix in elastic#8672 did not address the issue for the ```GeoPolygonFilter```. This was identified in issue elastic#5968

This fixes the ambiguous polygon issue in ```GeoPolygonFilter``` by moving the dateline crossing code from ```ShapeBuilder``` to ```GeoUtils``` and reusing the logic inside the ```pointInPolygon``` method.  Unit tests are added to ensure support for coordinates specified in either standard lat/lon or great-circle coordinate systems.

closes elastic#5968
closes elastic#9304
@clintongormley clintongormley changed the title [GEO] Update GeoPolygonFilter to handle polygons crossing the dateline Geo: Update GeoPolygonFilter to handle polygons crossing the dateline Feb 10, 2015
@clintongormley clintongormley changed the title Geo: Update GeoPolygonFilter to handle polygons crossing the dateline Update GeoPolygonFilter to handle polygons crossing the dateline Jun 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >enhancement v1.4.3 v1.5.0 v2.0.0-beta1
Projects
None yet
5 participants