Skip to content

SQL: Add initial geo support #29872

Closed
Closed
@elasticmachine

Description

@elasticmachine

Introduction

This is a meta issue for tracking initial iteration of adding geo features to SQL. Our implementation will be based on the OpenGIS® Implementation Standard for Geographic information - Simple feature access, which is the current standard for GIS system implementation. This effort will concentrate on SQL option AKA ISO 19125-2. Later on we might also consider adding support for SQL/MM (ISO 13249-3), which extends Simple Feature Access with circular interpolations.

The current work can be found in the geosql branch.

Initial Implementation plan

This effort will be divided in the following sub-issues

Queries that will be supported in the initial implementation

Initial minimal release should support the following commands:

Metadata commands

  • DESCRIBE table - returns the correct column type GEOMETRY for geo shapes
  • SYS_SPATIAL_REF - returns a table with a single spatial reference system WGS84
  • SYS_GEOMETRY_COLUMNS - returns a list of all geometry columns in all tables

Returning geoshapes and geopoints from elasticsearch

  • SELECT * FROM table - returns the geoshapes in their _source representation;
  • SELECT ST_AsWKT(geom) FROM table; and SELECT ST_AsText(geom) FROM table;- returns the geoshapes in their WKT representation;

Using geopoints to elasticsearch

  • The following functions will be supported for geopoints in queries and aggregations: ST_GeomFromText, "ST_X, ST_Y, ST_Z, ST_Distance`.
  • SELECT * FROM table WHERE ST_Distance(ST_GeomFromText(POINT(1 2), point) < 10; - returns all records for which point is located within 10m from the POINT(1 2) by using query.

Limitations:

Geoshapes cannot be used in queries, sorting and aggregations as part of this initial effort. In order to fully take advantage of geoshapes we would need to have access to geoshape doc values, which is coming in #37206. ST_Z cannot be used on geopoints in queries, sorting and aggregations since we don't store altitude in geo_point doc values.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions