Update docs on vertex ordering (#27963)

At time of writing, GeoJSON did not enforce a specific ordering of vertices in
a polygon, but it now does. We occasionally get reports of Elasticsearch
rejecting apparently-valid GeoJSON because of badly oriented polygons, and it's
helpful to be able to point at this bit of the documentation when responding.
This commit is contained in:
David Turner 2018-04-02 09:59:12 +01:00 committed by GitHub
parent e70cd35bda
commit 3ca9310aee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 14 deletions

View File

@ -378,22 +378,24 @@ POST /example/doc
// CONSOLE // CONSOLE
// TEST[skip:https://github.com/elastic/elasticsearch/issues/23836] // TEST[skip:https://github.com/elastic/elasticsearch/issues/23836]
*IMPORTANT NOTE:* GeoJSON and WKT do not enforce a specific order for vertices *IMPORTANT NOTE:* WKT does not enforce a specific order for vertices thus
thus ambiguous polygons around the dateline and poles are possible. To alleviate ambiguous polygons around the dateline and poles are possible.
ambiguity the Open Geospatial Consortium (OGC) https://tools.ietf.org/html/rfc7946#section-3.1.6[GeoJSON] mandates that the
http://www.opengeospatial.org/standards/sfa[Simple Feature Access] specification outer polygon must be counterclockwise and interior shapes must be clockwise,
defines the following vertex ordering: which agrees with the Open Geospatial Consortium (OGC)
http://www.opengeospatial.org/standards/sfa[Simple Feature Access]
specification for vertex ordering.
* Outer Ring - Counterclockwise Elasticsearch accepts both clockwise and counterclockwise polygons if they
* Inner Ring(s) / Holes - Clockwise appear not to cross the dateline (i.e. they cross less than 180° of longitude),
but for polygons that do cross the dateline (or for other polygons wider than
180°) Elasticsearch requires the vertex ordering to comply with the OGC and
GeoJSON specifications. Otherwise, an unintended polygon may be created and
unexpected query/filter results will be returned.
For polygons that do not cross the dateline, vertex order will not matter in The following provides an example of an ambiguous polygon. Elasticsearch will
Elasticsearch. For polygons that do cross the dateline, Elasticsearch requires apply the GeoJSON standard to eliminate ambiguity resulting in a polygon that
vertex ordering to comply with the OGC specification. Otherwise, an unintended polygon crosses the dateline.
may be created and unexpected query/filter results will be returned.
The following provides an example of an ambiguous polygon. Elasticsearch will apply
OGC standards to eliminate ambiguity resulting in a polygon that crosses the dateline.
[source,js] [source,js]
-------------------------------------------------- --------------------------------------------------