ADL 0.6.0 reference · Review draft 1 · November 14, 2026.
Contents · Source map · Evidence
The 0.6 edition note
This chapter retains the detailed language contract and its source-specific observations. Its chapter number and numbered sections remain stable. The 0.6 additions do not by themselves change this subject’s defaults or supply fresh execution evidence for it.
Reverification should cover spatial predicates, indexes, and store-specific behavior. Use the original examples and evidence links below to recover the earlier test context. The new edition’s source map records this chapter as inherited detail; the current draft does not claim those historical tests were rerun.
Retained reference detail
The numbered sections below are carried from 42-gis-and-spatial.md. Their original baseline and evidence remain attached to the source. Statements about “current” or “checked” behavior in this retained text refer to those original observations unless the edition note explicitly updates them. This is a consolidated draft, not a claim of complete re-verification.
42.1 Declaring a geometry field
This complete document is atlas.yaml:
adl: 0.5.1
domain:
name: atlas
version: 1.0.0
resources:
Feature:
object:
id: {type: integer, primaryKey: true}
name: {type: string, required: true}
minZoom: {type: integer}
geom:
type: geometry
required: true
geometryType: polygon
srid: 4326
permissions:
read: ['*']
create: [admin]
update: [admin]
delete: [admin]
indexes:
- fields: [minZoom]
The resource has public reads and admin writes. Its ordinary minZoom index
supports an application-defined level-of-detail filter. PostGIS spatial indexing
is generated from geom; it needs no resource indexes entry.
| Field attribute | Authoring meaning | Current native boundary |
|---|---|---|
type: geometry | A GeoJSON geometry value | Use this canonical type spelling |
Omitted geometryType | Any of the seven geometry kinds | Stored as an empty constraint; working unconstrained form |
geometryType | A specific kind from the table below | String values are lowercased; declaration spelling is case-insensitive |
srid | Spatial reference identifier; default 4326 | Integer metadata for PostGIS generation; no coordinate conversion |
required | Require a non-null value | Ordinary field validation applies |
The inherited geojson alias is rejected by the current native parser.
geojson-alias-boundary.yaml
fails submission with 422 PARSE_ERROR, suggesting geometry. The diagnostic
still calls the type inventory “ADL 0.5.0” even for this 0.5.1 document. The
independent modeller admits that alias; its acceptance is not native admission.
Omit geometryType for an unconstrained field. The inherited default “any”
describes the absence of a constraint. Writing the literal geometryType: any
is admitted but makes the native validator compare a geometry kind with any;
a Point then fails with geometry_type_mismatch. The modeller treats explicit
any as unconstrained. Both forms have complete boundary fixtures.
The parser also admits an unknown string kind such as circle and an integer
SRID of -1; it ignores a numeric kind or a quoted/boolean SRID. The latter SRIDs
leave the default 4326. These are observed admission gaps, not additional
legal values. The modeller diagnoses the circle/-1 fixture with
GEOMETRY_TYPE_INVALID and GEOMETRY_SRID_INVALID. Use a recognized kind and a
positive integer SRID; do not depend on silent defaults for malformed attributes.
See the current field model
and parser.
42.1.1 Geometry kinds and coordinate shape
The declaration uses lowercase kind names. A GeoJSON value uses the standard
case-sensitive names below. Positions start with longitude and latitude for
WGS84; a third coordinate can carry height. A position needs at least two
numbers, a LineString at least two positions, and a polygon ring at least four
positions with matching first and last positions. GeometryCollection uses
geometries and may be empty. These are GeoJSON format requirements, separate
from what the current ADL validator enforces.
GeoJSON RFC 7946, §3.1.
geometryType | GeoJSON type | Value member |
|---|---|---|
point | Point | coordinates: one position |
linestring | LineString | coordinates: array of positions |
polygon | Polygon | coordinates: array of rings; exterior first, holes after it |
multipoint | MultiPoint | coordinates: array of positions |
multilinestring | MultiLineString | coordinates: array of line coordinate arrays |
multipolygon | MultiPolygon | coordinates: array of polygon coordinate arrays |
geometrycollection | GeometryCollection | geometries: array of geometry objects |
A Feature or FeatureCollection wrapper is not a geometry value for this
field. Put application properties in the resource’s other fields. For example,
name belongs beside geom in an ADL record, not in a GeoJSON properties wrapper.
42.1.2 Write and read representation
A write can supply an object:
{
"name": "Ridge",
"minZoom": 1,
"geom": {
"type": "Polygon",
"coordinates": [[[10,20],[11,20],[11,21],[10,21],[10,20]]]
}
}
It can also supply a JSON string containing that object. The checked object and
string writes both persist successfully on all three backends; subsequent GET
and list responses contain geometry objects. Optional geometry fields accept
null or omission; the required field above rejects null with the ordinary
per-field required code. A valid optional null remains null in a response.
On PostgreSQL, the current generated create handler returns 201 with a
Created message after its SQLite-specific row-readback query fails. The insert
has already succeeded; independent GET/list checks verify the stored values.
Do not assume the PostgreSQL create response contains the created geometry.
This is a separate generated-CRUD gap, recorded in the evidence rather than
hidden by treating 201 alone as a round-trip test.
42.1.3 Validation and backend differences
The native geometry checks require an object, or a parseable JSON string of one,
a recognized type, and the appropriate outer array: coordinates or
geometries. If a kind constraint exists, it must match. Those checks do not
recursively validate coordinate structure, numeric ordinates, ring closure,
collection children, geographic ranges, or polygon topology. The current
FieldValidator
and ResourceValidator
show the two geometry-checking paths.
A Point submitted to the polygon field fails create, PATCH, and PUT with
422 VALIDATION_ERROR and data.geom.code: geometry_type_mismatch. A rejected
PATCH/PUT leaves the original polygon intact; changing only name preserves it.
A synthetic internal request also rejects the wrong geometry kind.
The following executed writes use an unconstrained geometry field so that
kind mismatch does not hide coordinate validation. “Stored” means a later list
returned the original JSON value. Each rejection leaves the disposable table
empty.
| Submitted value | SQLite | PostgreSQL, no PostGIS | PostgreSQL + PostGIS |
|---|---|---|---|
Point with only [10] | Stored | Stored | 500 DB_ERROR |
Point with ["ten","twenty"] | Stored | Stored | Stored; spatial column becomes Point [0,0] |
| Unclosed polygon ring | Stored | Stored | Stored; ST_IsValid returns false |
| Self-crossing polygon | Stored | Stored | Stored; ST_IsValid returns false |
Lowercase wire type point | Stored | Stored | Stored |
| Three-coordinate Point | Stored | Stored | Stored in the unconstrained spatial column |
Point [1000,2000] | Stored | Stored | Stored without geographic-range rejection |
| Empty GeometryCollection | Stored | Stored | Stored |
| Collection child missing coordinates | Stored | Stored | 500 DB_ERROR |
| Top-level Point missing coordinates | 422 invalid_geometry | Same | Same |
| Feature wrapper or malformed JSON string | 422 invalid_geometry | Same | Same |
The 422 rows use the VALIDATION_ERROR envelope; invalid_geometry is the
per-field code. The PostGIS 500 rows arise while computing the spatial column.
They are not deliberate client-facing validation diagnostics.
The independent modeller performs more shape checking: it rejects short/text positions, unclosed rings, and malformed collection children. It still accepts the tested self-crossing polygon, lowercase type, and out-of-range Point. It also rejects the empty GeometryCollection permitted by RFC 7946. Neither implementation is a complete GeoJSON or topological validator. Successful storage is not evidence that coordinates are suitable for spatial operations.
42.2 Storage
| Store | Authored value column | Generated spatial column | Spatial index |
|---|---|---|---|
| SQLite | geom TEXT | None | None |
| PostgreSQL without PostGIS | geom JSONB | None | None |
| PostgreSQL with PostGIS at initial creation | geom JSONB | geom__geom | gix_atlas_features_geom, using GiST |
The PostGIS portion of the initial table definition is equivalent to this DDL fragment:
"geom__geom" geometry(POLYGON,4326)
GENERATED ALWAYS AS (
ST_SetSRID(ST_GeomFromGeoJSON("geom"::text), 4326)
) STORED
The generator also emits:
CREATE INDEX IF NOT EXISTS gix_atlas_features_geom
ON atlas_features USING GIST ("geom__geom");
The JSONB value remains the stored API value. PostgreSQL recomputes the generated
spatial column from it. Ordinary checked responses omit geom__geom; the
response converter
strips that internal suffix. Generated columns are not client-write fields.
The textual-coordinate example in §42.1.3 shows why JSON and generated geometry
must not be assumed equivalent for malformed input.
42.2.1 Capability at creation
For a PostgreSQL model containing geometry, the
submit path
checks pg_extension for postgis and configures the
DDL generator.
Without the extension, submission still succeeds with JSONB storage. The source
contains a warning for that fallback; the live plain-PostgreSQL run verifies
successful storage and the absence of spatial columns and indexes.
PostGIS must be available in the target database before the initial spatial DDL is generated. Extension installation belongs to database deployment, described by KD 7 (v0.5.0, retired). This chapter’s runner creates the extension only in its own disposable database. Domain submission does not install it for the operator.
42.2.2 SRID labels do not transform coordinates
The generator calls ST_SetSRID, which changes spatial-reference metadata
without transforming coordinate values. Actual reprojection is a different
operation. PostGIS ST_SetSRID.
The projected-point fixture
declares srid: 3857. Writing Point [10,20] produces a spatial value whose
ST_SRID, ST_X, and ST_Y are 3857, 10, and 20. It does not convert
longitude/latitude to Web Mercator. Treat this fixture as a boundary experiment,
not as an example of correctly projected geographic data.
The filter envelope uses SRID 4326 regardless of the field declaration.
The tested 3857 field passes a numeric bounding-box overlap but fails an
intersects query with 500 DB_ERROR for mixed SRIDs. A successful bbox
therefore does not prove that coordinate systems agree. The ADL query API in
this build supplies no coordinate-transformation parameter.
42.3 Spatial filters
Use the ordinary filter[field][operator]=value request grammar. The generated
list and count handlers register geometry fields with the query builder.
ADL 27 owns general filtering, projection, and pagination.
The following are the implemented spatial operators:
| Operator | Value | Predicate against the generated column |
|---|---|---|
bbox | minLon,minLat,maxLon,maxLat | Bounding-box overlap with ST_MakeEnvelope(...,4326) |
intersects | JSON text of a geometry | ST_Intersects(geom__geom, ST_GeomFromGeoJSON(...)) |
within | JSON text of a geometry | ST_Within(geom__geom, ST_GeomFromGeoJSON(...)) |
A viewport query can be expressed as this illustrative HTTP request:
GET /api/v1/atlas/features?filter[geom][bbox]=0,0,30,30
URL-encode JSON and query parameter names as required by the HTTP client. The native evidence dispatches the corresponding parsed request data through the kernel; it does not start an HTTP server or verify transport decoding.
{"filter":{"geom":{"bbox":"0,0,30,30"}}}
42.3.1 Predicate meaning
bbox compares bounding rectangles, so it can return a feature whose actual
geometry does not intersect the requested region. In the checked polygon with
a central hole, a box inside that hole matches bbox; a Point inside the hole
matches no row under intersects.
within asks whether the stored geometry lies within the supplied geometry;
the direction matters. PostGIS additionally requires the interiors to have a
common point, so a point only on a polygon boundary is not within that polygon.
That boundary rule is from the function documentation, not a separately executed
ADL case. PostGIS ST_Within.
The near/far fixture returns one matching feature for bbox, intersects, and
within, and count returns total: 1 for the same bounding box. A disjoint box
returns zero rows. Combining an ordinary minZoom condition with the spatial
filter further restricts the result; selecting only name still filters on the
geometry and returns id and name without the geometry value.
42.3.2 Capability and malformed queries
| Request | SQLite | PostgreSQL, no PostGIS | PostgreSQL + PostGIS |
|---|---|---|---|
bbox on geom | Executes (GeoJSON envelope, #1708) | 500 DB_ERROR | Executes |
intersects or within on geom | 400 SPATIAL_UNSUPPORTED | 500 DB_ERROR | Executes |
Spatial operator on name | 400 INVALID_QUERY | Same | Same |
bbox with three components | 400 INVALID_QUERY | Same | Same |
bbox=0,0,30junk,30 | 400 INVALID_QUERY | Same | Same |
within with malformed JSON text | 400 SPATIAL_UNSUPPORTED | 500 DB_ERROR | 500 DB_ERROR |
bbox on SQLite (ADL plugin 0.109.0, #1708). SQLite has no spatial SQL, so
the query builder computes each row’s envelope per query from the stored GeoJSON.
The envelope is the minimum and maximum of every coordinate’s x and y, read with
json_tree over $.coordinates. A row matches when its envelope overlaps the
box, which is what PostGIS && answers. A point matches when it lies in the box,
edges included. Envelopes aren’t stored or indexed, so every query scans the
table. A GeometryCollection, which has no top-level coordinates, never
matches. intersects and within need real geometry. They stay
PostGIS-only, and SQLite refuses them with SPATIAL_UNSUPPORTED.
On PostgreSQL the query builder
checks the SQL dialect, not the extension or presence of the generated column.
Consequently, plain PostgreSQL receives spatial SQL it cannot execute, and the
inherited promise that every unavailable spatial query gives 400 is too broad.
bbox must have four finite numeric components, each one a complete number.
Before #1708 a numeric prefix such as 30junk passed the check and then failed
PostgreSQL’s numeric cast. Supply them in the order minLon, minLat, maxLon,
maxLat; the check is not comprehensive viewport validation. Query geometry is
passed to PostGIS without the native write validator. PostGIS expects a geometry
fragment, not a Feature wrapper, and its GeoJSON reader defaults to SRID 4326
when none is supplied.
PostGIS ST_GeomFromGeoJSON.
42.3.3 Unsupported operators can become equality
dwithin is not implemented. An unknown operator currently falls back to
ordinary equality rather than receiving a dedicated unsupported-operator error.
For the fixture’s filter[geom][dwithin]=10,20,5, SQLite returns an empty list
and PostgreSQL with or without PostGIS returns 500 DB_ERROR because the value
is not valid JSON for JSONB comparison. Supplying the polygon as valid JSON
instead returns one matching row on both PostgreSQL databases through JSONB
equality. That is not a distance query.
Use only the three implemented spatial operators above. A 200 status or a
plausible row count cannot establish that an unrecognized operator executed its
intended predicate.
42.4 Serving large layers
Viewport filtering, an application-defined level of detail, and response simplification can be combined:
GET /api/v1/atlas/features?filter[geom][bbox]=0,0,30,30&filter[minZoom][lte]=5&simplify=0.05
minZoom is an ordinary integer field with an ordinary index. ADL supplies no
special zoom type, automatic tiling, or zoom-to-tolerance conversion in this
feature. GiST supplies an index usable by spatial predicates; the chapter
verifies its creation and query results, not planner choices or throughput.
Use the ordinary pagination and projection controls when serving large result
sets. ADL 33 owns bulk operations and their separate checks.
42.4.1 Simplified list responses
A nonnegative simplify tolerance adds ST_Simplify expressions to a PostgreSQL
list query. The response substitutes their GeoJSON for the selected base geometry
fields; it does not update the stored JSON. Tolerance uses the input coordinate
system’s units, so 4326 coordinates use degrees rather than meters.
ST_Simplify may collapse components or produce invalid polygon topology; the
current expression does not request topology preservation.
PostGIS ST_Simplify.
The checked polygon ring has 13 positions, counting the closing position:
| List request | Observed PostGIS response |
|---|---|
simplify=0 | Five positions; collinear intermediate positions are removed |
simplify=0.2 | Five positions, including closure |
simplify=100 | geom: null after collapse |
simplify=-1 or simplify=abc | 400 INVALID_QUERY |
simplify=0.2junk | Same five-position result as 0.2 |
simplify=nan | 500 DB_ERROR |
fields=name&simplify=0.2 | Only selected name and retained id; no geometry |
The null result is possible even though the stored geometry field is required.
A subsequent GET still returns the original polygon. GET does not simplify it
when supplied the same parameter; count ignores even simplify=abc and returns
the ordinary total. These parameters do not have uniform operation coverage.
For an accepted tolerance, including zero, SQLite returns 400 INVALID_QUERY; PostgreSQL without
PostGIS returns 500 DB_ERROR from the generated spatial SQL. Omit simplify
to request an ordinary list without simplification. As with bbox, numeric
prefix acceptance is an implementation gap. Use complete finite, nonnegative
values and choose tolerance for the actual coordinate units. See the current
list/count handlers.
42.5 OpenAPI and model export
The generated OpenAPI geometry property is an object with a type enum containing
the seven canonical names, a coordinates array, and a geometries array whose
items are objects. Only type is required inside that geometry schema.
The resource’s ordinary required array separately includes the required geom
field. Read and input geometry schemas agree in the checked example.
This is a broad description, not a complete GeoJSON schema. It does not require
coordinates for a Point, describe numeric position nesting, recursively constrain
collection children, narrow the seven-name enum to geometryType: polygon, or
publish the field’s SRID. It also does not describe the JSON-string input form
accepted by writes. A generated client needs additional geometry validation and
must account for simplified responses that can contain null (§42.4).
See OpenAPI generation.
The ADL model exporter has a different purpose. It retains type: geometry, a
nonempty geometryType, and srid. In the checked registry round trips, geometry
kind and SRID survive both normal source-backed loading and a deliberately
forced load from the stored model with authored/resolved source cleared.
This holds for constrained and unconstrained geometry fields, including the
3857 boundary fixture. The experiment does not imply that an intact registry
normally loses its source. See model export
and registry restoration.
42.6 Limitations and verification boundary
42.6.1 Adding a geometry field through migration
The version 1.1 fixture adds an optional
centre Point field to an existing resource. On all three stores, submission
succeeds and PATCH/GET can store and retrieve its JSON value. On PostGIS,
centre is only JSONB: the catalog has no centre__geom column or corresponding
GiST index. Filtering centre then fails with 500 DB_ERROR; filtering the
original geom still succeeds.
The full-create generator emits the generated column and spatial index, while add-column migration emits the portable value column. Adding a geometry field therefore does not establish spatial-query capability for that field. Enabling an extension or changing the declaration alone is not a demonstrated repair for an existing table. Review the actual catalog and prepare an explicit data-preserving spatial migration before depending on the new field’s queries. ADL 17 owns schema evolution; KD 7 (v0.5.0, retired) owns backend deployment. This chapter does not prescribe dropping a populated table.
42.6.2 What the evidence establishes
The fresh run covers 121 native cases: 13 parser/model projections, 27 direct geometry-validator cases, 14 query-builder cases, and 67 disposable store sequences. Seven complete YAML fixtures have independent modeller checks. Eight existing geometry/spatial tests pass. Assertions include expected rejections and observed gaps; passing them is not a full conformance verdict.
The live PostgreSQL checks use current PgStore and StoreConnectionDb with
isolated schemas. Registry state is a separate temporary SQLite database; no
claim is made about a PostgreSQL registry deployment. Requests use synthetic
admin identities and transport labels. There is no HTTP authentication, bulk
import, concurrency, planner/performance, raster, geography-distance, tile-server,
or exhaustive coordinate-system test. The unconstrained three-dimensional Point
case does not establish support for every typed PostGIS dimensional constraint.
Source provenance links to actual repository files and records revisions and hashes. No production-source copies are stored in the manual. The evidence report explains the adapter’s readback limitation, independent modeller differences, precise assertions, and reproduction.
42.7 Related chapters
| Subject | Owning chapter |
|---|---|
| Field types and nullability | ADL 10 |
| Ordinary resource indexes | ADL 15 |
| Schema evolution and migration | ADL 17 |
| Validation rules and errors | ADL 20, ADL 31 |
| Read/write permissions | ADL 21 |
| Generated routes and query grammar | ADL 26, ADL 27 |
| OpenAPI and schema endpoints | ADL 32 |
| Bulk loading | ADL 33 |
| Stores and database capabilities | KD 7 (v0.5.0, retired) |