Geospatial Operations
Astral provides verifiable spatial computations backed by PostGIS — the gold standard in geospatial databases with 20+ years of production use. All operations return Policy Attestations — signed results that can be used offchain or submitted onchain to trigger smart contract logic.PostGIS uses GEOS (Geometry Engine Open Source) under the hood for geometry operations. GEOS is the C++ library that powers most professional geospatial software.
Available Operations
Measurements
Operations that return numeric results (as NumericPolicyAttestations):Predicates
Operations that return boolean results (as BooleanPolicyAttestations):Operation Examples
Code snippets need testing — Verify against actual implementation before use.
Distance
Calculate the nearest distance between two geometries in meters. For polygons, this returns the minimum distance between their boundaries.Contains
Check if a geometry is entirely inside a container geometry.Within
Check if a geometry is within a specified radius of a target — essentially a radius check.Intersects
Check if two geometries share any space (overlap, touch, or cross).Area
Calculate the area of a polygon (must be Polygon or MultiPolygon).Length
Calculate the length of a line (must be LineString or MultiLineString).Units
All measurements use metric units only:No unit conversion options are provided. Developers should convert client-side if needed.
Precision
Results are stored with centimeter precision to enable deterministic, reproducible computation:We’re actively testing the reliability of deterministic geospatial computation with this precision approach. This is an area of ongoing research in the beta implementation.
Compute Options
All operations require these parameters:We only support official EAS deployments on supported chains. See the SDK overview for the chain list.
Future Operations
Post-MVP, we plan to add:
We’re also exploring nested/composable operations — combining multiple predicates in a single attestation, such as “is inside region A AND within 500m of landmark B”.
Client-Side Operations with Turf.js
We recommend Turf.js for client-side geospatial operations. Use Turf.js for instant UX feedback, and Astral for verifiable attestations:Next: Policy Attestations
Learn about the signed outputs of geospatial operations