Skip to content

WKT and GeoJSON's shape types need proper capitalization #49568

Closed
@talevy

Description

@talevy

situation

Elasticsearch's WKT and GeoJSON writers lowercase a shape's type.
So WKT's POINT is written as point, and GeoJSON's Point is written
as point. The specs for these formats explicitly define proper capitalization
rules.

Another point: Elasticsearch's parsers are case-insensitive... need to determine
whether that is OK to keep.

The only place that this seems to be a user-facing problem is with the
Circle Processor:

PUT circles/_doc/1?pipeline=polygonize_circles
{ "circle": "CIRCLE (30 10 40)" }

PUT circles/_doc/2?pipeline=polygonize_circles
{ "circle": { "type": "circle", "coordinates": [101, 1], "radius": "100m" } }

GET circles/_search?filter_path=hits.hits._source.circle
...
        "_source" : {
          "circle" : "polygon ((30.000365257263184 10.0, 30.000111397193788 10.00034284530941, 29.999706043744222 10.000213571721195, 29.999706043744222 9.999786428278805, 30.000111397193788 9.99965715469059, 30.000365257263184 10.0))"
        }
      },
      {
        "_source" : {
          "circle" : {
            "type" : "polygon",
            "coordinates" : [
              [
                [
                  101.00090026855469,
                  1.0
                ],
                ...

GeoJSON Spec

link: https://tools.ietf.org/html/rfc7946

Inside this document, the term "geometry type" refers to seven
case-sensitive strings: "Point", "MultiPoint", "LineString",
"MultiLineString", "Polygon", "MultiPolygon", and
"GeometryCollection".

WKT Spec

link: http://docs.opengeospatial.org/is/18-010r7/18-010r7.html

Keywords are case-insensitive. Where human readability of the string is important, as in this document, keywords are normally in upper case.

Proposed Fix

To adhere to the GeoJSON spec, it is important that proper capitalization
of the geometry types are used. The WKT spec is flexible, but since it is
common practice to capitalize the types for human-readability, it would be
nice to capitalize them in WKT as well.

Metadata

Metadata

Assignees

Labels

:Analytics/GeoIndexing, search aggregations of geo points and shapes>bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions