Geometry Types
The SDK provides GeoJSON-compatible geometry types for working with SurrealDB's spatial data. All geometry classes extend the Geometry base class.
Individual types can also be imported from surrealdb.data.types.geometry.
GeometryPoint
A single geographic point defined by longitude and latitude.
Constructor
| Parameter | Type | Description |
|---|---|---|
longitude | float | The longitude coordinate. |
latitude | float | The latitude coordinate. |
Examples
GeometryLine
A line defined by two or more points.
Constructor
| Parameter | Type | Description |
|---|---|---|
points | list[GeometryPoint] | An ordered list of points that define the line. |
Examples
GeometryPolygon
A polygon defined by one or more linear rings. The first ring is the exterior boundary; any subsequent rings are interior holes. Rings must be closed — the first and last point must be identical, following the GeoJSON specification.
Constructor
| Parameter | Type | Description |
|---|---|---|
rings | list[GeometryLine] | A list of linear rings. The first is the exterior ring; others are holes. |
Examples
GeometryMultiPoint
A collection of points.
Constructor
| Parameter | Type | Description |
|---|---|---|
points | list[GeometryPoint] | A list of points. |
Examples
GeometryMultiLine
A collection of lines.
Constructor
| Parameter | Type | Description |
|---|---|---|
lines | list[GeometryLine] | A list of lines. |
Examples
GeometryMultiPolygon
A collection of polygons.
Constructor
| Parameter | Type | Description |
|---|---|---|
polygons | list[GeometryPolygon] | A list of polygons. |
Examples
GeometryCollection
A heterogeneous collection of geometry objects. Unlike the other multi-types, a GeometryCollection can contain a mix of different geometry types.
Constructor
| Parameter | Type | Description |
|---|---|---|
geometries | list[Geometry] | A list of geometry objects of any type. |
Examples
Usage
See Also
Data Types — All SDK data types
RecordID — Record identifier
SurrealQL Geometry Functions — Geospatial query functions