Closed VijayanB closed 2 years ago
I'll ask here, since I haven't really managed to figure out the use case for the field. We're indexing multiple type of coordinates, some of which are Cartesian, and some require conversion to Cartesian.
Thing is, when using grid based system.(such as Mercator systems) , you usually need , well, the grid. And as far as UTM goes, the zone. I may be misunderstanding the field in lucene, but I see none of these parameters. Is there an implied underlying grid? What is the use case there precisely?
Note that supporting everything that lucene has is obviously a priority, but I really can't figure out the use of this field.
Note that supporting everything that lucene has is obviously a priority, but I really can't figure out the use of this field.
This isn't just for geospatial applications. If you think of anything prefixed w/ geo
implies geographic (e.g., locations on an ellipsoid), this field is for cartesian locations. So for geospatial applications it can be used for projections to a local custom grid, when used in conjunction w/ a Z
field it can represent ENU, ECF. Add a zone field to a boolean query and you can absolutely use mercator grid.
Beyond that it works for other spatial applications like virtual worlds, CAD documents, amusement park mapping, VR, and sporting venus (e.g., MLB, NHL, NFL. NBA, MLS analytics).
Think of it as a field that uses euclidean distances instead of haversine; so sorting is much faster w/o having to hijack the geo
field for non-geographic spatial applications.
Development is completed. Please open a bug report or enhancement in future.
The purpose of this RFC (request for comments) is to gather community feedback on a new proposal to allow OpenSearch users to facilitate indexing and searching documents that contains X, Y cartesian planar shapes.
XYShape Field Type
The
xy_shape
field type supports the indexing and searching geometries whose vertices are unit less x, y values such as rectangles, line string, polygons, etc... This will be used by users who would want to index and query geometries whose coordinates represent from 2D planar system. This will be similar togeo_shape
field except it will represent cartesian plane which is not based on earth-fixed terrestrial reference system. This new field will be based on Lucene field type XYShape.Mapping Options
In order to index documents that contains
xy_shape
fields, users must explicitly map fields to thexy_shape
type. This is similar togeo_shape
field.Example
The below mapping definition maps the geometry field to the
xy_shape
type using defaults.The following options are accepted to be part of xy_shape field as inner type.
Overrides default value inside mapping
Indexing structure
Shapes can be represented using either as
GeoJSON
orWell-Known Text
(WKT)
format. The following table provides a mapping of GeoJSON and WKT to OpenSearch types:Point
POINT
point
LineString
LINESTRING
linestring
Polygon
POLYGON
polygon
MultiPoint
MULTIPOINT
multipoint
MultiLineString
MULTILINESTRING
multilinestring
MultiPolygon
MULTIPOLYGON
multipolygon
GeometryCollection
GEOMETRYCOLLECTION
geometrycollection
N/A
BBOX
envelope
[[minX, maxY], [maxX, minY]]
Note: The precision of shape is based on number of vertices and point.
The field should have
type
andcoordinates
fields as inner type to represent above mentioned type and coordinates values.Example
Using point type
Using polygon type
Using Geometry Collection
Geometry collection would be helpful to represent multiple disjoint
xy_shapes
as part of one document.Indexing Strategy
This field type is indexed by encoding this geometry into a triangles and indexing each triangle as a 7 dimension point in a BKD tree, similar to
geo_shape
. The coordinates provided to the indexer are single precision floating point values.XYShape Query Type
Queries documents that contain fields indexed using (i)
xy_shape
type, which either intersect, are contained by, are within or do not intersect with the specifiedxy_shape
(ii)xy_point
type, which intersect/contains/within with the specifiedxy_shape
The query supports two ways of defining the query for documents that contains xy_shape, either by providing a new target xy_shape definition, or by referencing pre-indexed xy_shape from another index.
Using new target shape definition
Here the target xy_shape is defined as an envelope to search for documents, that contains xy_shape within this boundary
Using pre-index shape from another index
Here the target xy_shape is referenced from a field in separate index with default spatial relationship ( intersects)
Spatial Relations between xy_shapes
The following is a complete list of spatial relation operators available:
INTERSECTS
- (default) Return every documents that containsxy_shape
field intersects with the query geometry.DISJOINT
- Return every documents that containsxy_shape
field which has nothing in common with the query geometry.CONTAINS
- Return every documents that hasxy_shape
field which contains the query geometry.WITHIN
- Return every documents that hasxy_shape
field is within the query geometry.