Jadpo is experimental and not ready for production. These docs follow the compiler's main branch as of 1 Nov 2026. What's built · Install 0.2.0
jadpo
Reference: Standard library

Standard types

MultiPolygon

On this page

Areas, at least one: a GeoJSON MultiPolygon.

Geospatial; not ordered; since Jadpo 0.1.0.

Make one

Build one from its fields, MultiPolygon { polygons: ... }.

Its parts keep these rules; a value that breaks one fails with the rule's name:

  • altitudes_agree: every position with an altitude, or none

Fields

Field Type
polygons List<Polygon>

Text, JSON and storage

It has no single text form, so text.from and text.parse don't take it. JSON sends a GeoJSON geometry, its positions longitude first.

JSON
{"type":"MultiPolygon","coordinates":[[[[0,0],[1,0],[1,1],[0,1],[0,0]]],[[[2,2],[3,2],[3,3],[2,3],[2,2]]]]}
{"type":"MultiPolygon","coordinates":[[[[0,0],[1,0],[1,1],[0,1],[0,0]]]]}

It is stored in one column named for the field, of type geography. {"type":"MultiPolygon","coordinates":[[[[0,0],[1,0],[1,1],[0,1],[0,0]]]]} is stored as 'SRID=4326;MULTIPOLYGON (((0 0, 1 0, 1 1, 0 1, 0 0)))'::geography.

Shown to people

text.format(value, locale:) shows it to people in their locale.

With locale: Locale.en_gb:

Value Shown
{"type":"MultiPolygon","coordinates":[[[[0,0],[1,0],[1,1],[0,1],[0,0]]],[[[2,2],[3,2],[3,3],[2,3],[2,2]]]]} (((0°, 0°; 0°, 1° E; 1° N, 1° E; 1° N, 0°; 0°, 0°)), ((2° N, 2° E; 2° N, 3° E; 3° N, 3° E; 3° N, 2° E; 2° N, 2° E)))
{"type":"MultiPolygon","coordinates":[[[[0,0],[1,0],[1,1],[0,1],[0,0]]]]} (((0°, 0°; 0°, 1° E; 1° N, 1° E; 1° N, 0°; 0°, 0°)))

Operations

  • geo.area(shape: T) -> Area: A Polygon's or MultiPolygon's area on the ellipsoid, each edge a geodesic and each ring the smaller of the two sides it bounds, holes taken away, rounded half to even to the square millimetre.
  • geo.bounding_box(shape: T) -> BoundingBox: The smallest box of parallels and meridians holding the shape, an edge's highest or lowest point counted, across the antimeridian when that box is narrower; a shape holding a pole runs from -180 to 180.
  • geo.centroid(shape: T) -> Point: The shape's centre on the sphere, as PostGIS's ST_Centroid(x, false) finds it: each point a unit vector, weighted by area, length or count by the shape's kind, summed, and back to latitude and longitude. It may lie outside a concave polygon.
  • geo.contains(a: T, b: U) -> Bool: Whether no point of b lies outside a, edges included. a may be a BoundingBox, whose sides are compared directly, or a Circle, holding the points within its radius of its centre.
  • geo.intersects(a: T, b: U) -> Bool: Whether the two share at least one point, edges included.
  • geo.to_wkt(shape: T) -> Text: The shape as WKT, longitude first, as PostGIS's ST_AsText writes it: POINT(-0.1276 51.5072), POINT Z (-0.1276 51.5072 35) with an altitude, each ring in the order it holds its points.
  • geo.within(a: T, b: U, distance: Length?) -> Bool: geo.contains(b, a); or, with distance:, whether two points are at most that far apart, as geo.distance measures them.

Like every standard type, it also has the contract's own operations: text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.

Markdown for agents: /docs/types/type-multi-polygon.md.Built from Jadpo main at e00e61f.