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

[DOCS] Clarify orientation usage for WKT and GeoJSON polygons #84025

Merged
merged 7 commits into from
Feb 17, 2022
Merged

[DOCS] Clarify orientation usage for WKT and GeoJSON polygons #84025

merged 7 commits into from
Feb 17, 2022

Conversation

jrodewig
Copy link
Contributor

@jrodewig jrodewig commented Feb 16, 2022

Clarifies that the orientation mapping parameter only applies to WKT polygons. GeoJSON polygons use a default orientation of RIGHT, regardless of the mapping parameter.

Also notes that the document-level orientation parameter overrides the default orientation for both WKT and GeoJSON polygons.

Closes #84009.

Preview

https://elasticsearch_84025.docs-preview.app.elstc.co/guide/en/elasticsearch/reference/master/geo-shape.html#geo-polygon

@jrodewig jrodewig added :Analytics/Geo Indexing, search aggregations of geo points and shapes >docs General docs changes v7.14.3 v7.15.3 v7.16.4 v7.17.1 v8.0.1 v8.1.1 labels Feb 16, 2022
@jrodewig jrodewig requested a review from iverase February 16, 2022 13:37
@jrodewig jrodewig marked this pull request as ready for review February 16, 2022 13:37
@elasticmachine elasticmachine added Team:Docs Meta label for docs team Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels Feb 16, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

@iverase
Copy link
Contributor

iverase commented Feb 16, 2022

What I learnt today goes even further.

The orientation parameter in the geo_shape field only affects geometries indexed using WKT (because WKT does not enforce vertex order). If indexing geojson the parameter is ignored and orientation is assumed to be CCW regardless of that parameter as in the standard.

Still you can enforce the orientation of a geojson geometry by adding the parameter orientation in the geojson itself like in:

POST /example/_doc
{
  "location" : {
    "type" : "polygon",
    "orientation" : "LEFT",
    "coordinates" : [
      [ [-177.0, 10.0], [176.0, 15.0], [172.0, 0.0], [176.0, -15.0], [-177.0, -10.0], [-177.0, 10.0] ]
    ]
  }
}

@jrodewig jrodewig changed the title [DOCS] Re-add note about WKT and GeoJSON vertex order [DOCS] Clarify orientation usage for WKT and GeoJSON polygons Feb 16, 2022
@jrodewig
Copy link
Contributor Author

Thanks for the clarification @iverase. Rather than re-add the previous note as-is, I reworked the current polygon orientation docs to include the relevant content. Let me know what you think.

Copy link
Contributor

@iverase iverase left a comment

Choose a reason for hiding this comment

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

We need to do just a small correction.

While we are here, should we update the Geojson examples so the types are properly capitalise?

Check it here: https://en.wikipedia.org/wiki/GeoJSON

shapes use a clockwise orientation.

You can override the default orientation for WKT and GeoJSON polygons using the
document-level `orientation` parameter. For example, the following indexing
Copy link
Contributor

@iverase iverase Feb 17, 2022

Choose a reason for hiding this comment

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

I don't think this is true for WKT as you cannot add a document level orientation, that's the reason you need to do it in the mapping.

For GeoJson it is done as shown in the example

Copy link
Contributor

@iverase iverase left a comment

Choose a reason for hiding this comment

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

Thanks for your patience @jrodewig!

@jrodewig
Copy link
Contributor Author

Thanks @iverase!

@jrodewig jrodewig merged commit 6ad3f8b into elastic:master Feb 17, 2022
@jrodewig jrodewig deleted the docs__rea-add-vertices-order-note branch February 17, 2022 15:33
@jrodewig
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.1
8.0
7.17
7.16
7.15
7.14

Questions ?

Please refer to the Backport tool documentation

elasticsearchmachine pushed a commit that referenced this pull request Feb 17, 2022
…) (#84130)

Clarifies that the `orientation` mapping parameter only applies to WKT polygons. GeoJSON polygons use a default orientation of `RIGHT`, regardless of the mapping parameter.

Also notes that the document-level `orientation` parameter overrides the default orientation for both WKT and GeoJSON polygons.

Closes #84009.

(cherry picked from commit 6ad3f8b)
elasticsearchmachine pushed a commit that referenced this pull request Feb 17, 2022
…) (#84132)

Clarifies that the `orientation` mapping parameter only applies to WKT polygons. GeoJSON polygons use a default orientation of `RIGHT`, regardless of the mapping parameter.

Also notes that the document-level `orientation` parameter overrides the default orientation for both WKT and GeoJSON polygons.

Closes #84009.

(cherry picked from commit 6ad3f8b)
elasticsearchmachine pushed a commit that referenced this pull request Feb 17, 2022
…) (#84131)

Clarifies that the `orientation` mapping parameter only applies to WKT polygons. GeoJSON polygons use a default orientation of `RIGHT`, regardless of the mapping parameter.

Also notes that the document-level `orientation` parameter overrides the default orientation for both WKT and GeoJSON polygons.

Closes #84009.

(cherry picked from commit 6ad3f8b)
elasticsearchmachine pushed a commit that referenced this pull request Feb 17, 2022
…) (#84134)

Clarifies that the `orientation` mapping parameter only applies to WKT polygons. GeoJSON polygons use a default orientation of `RIGHT`, regardless of the mapping parameter.

Also notes that the document-level `orientation` parameter overrides the default orientation for both WKT and GeoJSON polygons.

Closes #84009.

(cherry picked from commit 6ad3f8b)
elasticsearchmachine pushed a commit that referenced this pull request Feb 17, 2022
…) (#84133)

Clarifies that the `orientation` mapping parameter only applies to WKT polygons. GeoJSON polygons use a default orientation of `RIGHT`, regardless of the mapping parameter.

Also notes that the document-level `orientation` parameter overrides the default orientation for both WKT and GeoJSON polygons.

Closes #84009.

(cherry picked from commit 6ad3f8b)
elasticsearchmachine pushed a commit that referenced this pull request Feb 17, 2022
…) (#84135)

Clarifies that the `orientation` mapping parameter only applies to WKT polygons. GeoJSON polygons use a default orientation of `RIGHT`, regardless of the mapping parameter.

Also notes that the document-level `orientation` parameter overrides the default orientation for both WKT and GeoJSON polygons.

Closes #84009.

(cherry picked from commit 6ad3f8b)
weizijun added a commit to weizijun/elasticsearch that referenced this pull request Feb 18, 2022
* upstream/master: (167 commits)
  Mute FrozenSearchableSnapshotsIntegTests#testCreateAndRestorePartialSearchableSnapshot
  Mute LdapSessionFactoryTests#testSslTrustIsReloaded
  Fix spotless violation from last commit
  Mute GeoGridTilerTestCase#testGeoGridSetValuesBoundingBoxes_UnboundedGeoShapeCellValues
  Small formatting clean up (elastic#84144)
  Always re-run Feature migrations which have encountered errors (elastic#83918)
  [DOCS] Clarify `orientation` usage for WKT and GeoJSON polygons (elastic#84025)
  Group field caps response by index mapping hash (elastic#83494)
  Shrink join queries in slow log (elastic#83914)
  TSDB: Reject the nested object fields that are configured time_series_dimension (elastic#83920)
  [DOCS] Remove note about partial response from Bulk API docs (elastic#84053)
  Allow regular data streams to be migrated to tsdb data streams. (elastic#83843)
  [DOCS] Fix `ignore_unavailable` parameter definition (elastic#84071)
  Make Metadata extend AbstractCollection (elastic#83791)
  Add API specs for OpenID Connect APIs
  Revert "Clean up for superuser role name references (elastic#83627)" (elastic#84096)
  Update Lucene analysis base url (elastic#84094)
  Avoid null threadContext in ResultDeduplicator (elastic#84093)
  Use static empty store files metadata (elastic#84034)
  Preserve context in snapshotDeletionListeners (elastic#84089)
  ...

# Conflicts:
#	x-pack/plugin/rollup/build.gradle
probakowski pushed a commit to probakowski/elasticsearch that referenced this pull request Feb 23, 2022
…tic#84025)

Clarifies that the `orientation` mapping parameter only applies to WKT polygons. GeoJSON polygons use a default orientation of `RIGHT`, regardless of the mapping parameter.

Also notes that the document-level `orientation` parameter overrides the default orientation for both WKT and GeoJSON polygons.

Closes elastic#84009.
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 >docs General docs changes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Docs Meta label for docs team v7.14.3 v7.15.3 v7.16.4 v7.17.1 v8.0.1 v8.1.1 v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot capture New Zealand using Orientation
4 participants