elasticsearch/elasticsearch — pull request #8762 by nknize (2014-12-03 13:54:38+00:00)
Title: [GEO] Feature/Fix for OGC compliant polygons failing with ambiguity

This feature/fix implements OGC compliance for Polygon/Multi-polygon to correctly cross the dateline without requiring the user specify invalid lat/lon pairs (e.g., 183/-70). That is, vertex order for the exterior ring follows the right-hand rule (ccw) and all holes follow the left-hand rule (cw). While GeoJSON imposes no restrictions, a user that wants to specify a complex poly across the dateline can now do so in compliance with the OGC spec, otherwise a polygon that spans the globe will be assumed. Note that this could break a users current vertex order (i.e., the user specified a non-dateline crossing global poly in cw order - see ShapeBuilderTests.testShapeWithAlternateOrientation). In this case the user would have to comply with OGC standards and reorder the vertices ccw. This does not, however, break existing ordering for polys < 180 degrees (90% of most geo datasets) or invalid lat/lon pairs. So a user or existing deployment can still specify a dateline crossing poly using invalid lat/lon pairs. This simply implements OGC compliance to handle the ambiguous polygon problem.

Closes #8672