polygon (POLYGON) dictionary is optimized for point-in-polygon queries, essentially “reverse geocoding” lookups.
Given a coordinate (latitude/longitude), it efficiently finds which polygon/region (from a set of many polygons, such as country or region boundaries) contains that point.
It’s well-suited for mapping location coordinates to their containing region.
- DDL
- Configuration file
When configuring the polygon dictionary, the key must have one of two types:
- A simple polygon. It is an array of points.
- MultiPolygon. It is an array of polygons. Each polygon is a two-dimensional array of points. The first element of this array is the outer boundary of the polygon, and subsequent elements specify areas to be excluded from it.
| Layout | Description |
|---|---|
POLYGON_SIMPLE | Naive implementation. A linear pass through all polygons is made for each query, checking membership without additional indexes. |
POLYGON_INDEX_EACH | A separate index is built for each polygon, allowing fast membership checks in most cases (optimized for geographical regions). A grid is superimposed on the area, recursively dividing cells into 16 equal parts. Division stops when recursion depth reaches MAX_DEPTH or a cell crosses no more than MIN_INTERSECTIONS polygons. |
POLYGON_INDEX_CELL | Also creates the grid described above with the same options. For each leaf cell, an index is built on all polygon pieces that fall into it, allowing fast query responses. |
POLYGON | Synonym for POLYGON_INDEX_CELL. |
store_polygon_key_column = 1 in the dictionary configuration or corresponding DDL-query.
Query
Response