Skip to main content
Research Preview — This API is under development.

Area

Calculate the area of a polygon in square meters.
POST /compute/v0/area

Request Body

chainId
number
required
Target chain ID (e.g., 84532 for Base Sepolia, 8453 for Base).
geometry
Input
required
The polygon geometry to measure.
schema
string
required
EAS schema UID to issue the attestation against.
recipient
string
Ethereum address to receive the attestation. Defaults to zero address if not provided.

Example Request

curl -X POST https://api.astral.global/compute/v0/area \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": 84532,
    "geometry": "0xpolygon...",
    "schema": "0xschema...",
    "recipient": "0xdef456..."
  }'

Example Response

{
  "result": 5432.10,
  "units": "square_meters",
  "operation": "area",
  "timestamp": 1706400000,
  "inputRefs": [
    "0xpolygon..."
  ],
  "attestation": {
    "schema": "0x...",
    "attester": "0x...",
    "recipient": "0xdef456...",
    "data": "0x...",
    "signature": "0x..."
  },
  "delegatedAttestation": {
    "signature": "0x...",
    "attester": "0x...",
    "deadline": 1706403600
  }
}

Notes

  • Uses PostGIS ST_Area function with geodetic calculation
  • Result is in square meters with square centimeter precision
  • Only valid for polygon geometries

SDK Method

See astral.compute.area()