GeoPolygon: {
    holes?: GeoPoint[][];
    outerRing: GeoPoint[];
} | CanonicalGeoPolygon

Represents a polygon in spherical geometry that can be used as an argument for geospatial queries. The polygon is comprised of at least one outer ring and optionally multiple internal rings representing holes with the following restrictions:

  • Each ring must contains at least 3 distinct points, where the first and the last point must be the same to indicate a closed ring (this means that each ring must have at least 4 points).
  • The interior rings must be entirely inside the outer ring.
  • Rings can share vertices but not edges.
  • No ring may be empty.

Type declaration

Example

let polygon: GeoPolygon = {
outerRing: [
[-2, -2],
[3.45, -4.23],
[2.56, 4.62],
[-3.23, 2.5],
[-2, -2],
],
};
realm.objects(Restaurant).filtered("location geoWithin $0", polygon)

Generated using TypeDoc