Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/danizd/geoviable/llms.txt

Use this file to discover all available pages before exploring further.

The /analyze endpoint accepts a GeoJSON Feature with a Polygon or MultiPolygon geometry, validates it, runs the full spatial analysis against all 7 environmental layers stored in PostGIS, and returns the results as JSON. It is primarily used by the frontend to preview layer intersections on the map before the user decides to generate a PDF report. Method and path: POST /api/v1/analyze

Request

Content-Type: application/json The request body must be a GeoJSON Feature object with a valid polygon geometry in EPSG:4326 (WGS84 longitude/latitude).

Parameters

type
string
required
Must be "Feature".
geometry
object
required
GeoJSON geometry object describing the parcel boundary.
properties
object
Optional properties object. Any content is accepted and ignored by the API.

Request Example

{
  "type": "Feature",
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [-8.5449, 42.8782],
        [-8.5400, 42.8782],
        [-8.5400, 42.8750],
        [-8.5449, 42.8750],
        [-8.5449, 42.8782]
      ]
    ]
  },
  "properties": {}
}

Validation

All geometry is validated before the spatial query runs. The first failing rule immediately returns an error — rules are checked in the order listed.
RuleError CodeHTTP
Valid JSONINVALID_JSON400
Valid GeoJSON Feature (or FeatureCollection with 1 feature)INVALID_GEOJSON400
Polygon or MultiPolygon geometry onlyINVALID_GEOMETRY_TYPE400
Single polygon per requestMULTIPLE_FEATURES400
Valid topology (no self-intersections)INVALID_TOPOLOGY400
Inside Galicia bounding box [-9.5, 41.5, -6.5, 44.0]OUT_OF_BOUNDS400
Area ≤ 100 km²AREA_TOO_LARGE400
Vertices ≤ 10,000TOO_MANY_VERTICES400

Response — 200 OK

A successful response wraps the full analysis result under a top-level analysis key.
analysis
object
Top-level container for the analysis result.

Response Example

{
  "analysis": {
    "parcel": {
      "area_m2": 25430.5,
      "area_ha": 2.54,
      "centroid": [-8.5424, 42.8766],
      "crs_used": "EPSG:25830"
    },
    "layers": [
      {
        "layer_name": "red_natura_2000",
        "display_name": "Red Natura 2000",
        "affected": true,
        "features": [
          {
            "nombre": "Complexo húmido de Corrubedo",
            "tipo": "ZEC",
            "codigo": "ES1110006",
            "area_interseccion_m2": 12500.3,
            "porcentaje_solape": 49.15
          }
        ]
      },
      {
        "layer_name": "zonas_inundables",
        "display_name": "Zonas inundables (SNCZI)",
        "affected": false,
        "features": []
      },
      {
        "layer_name": "dominio_publico_hidraulico",
        "display_name": "Dominio Público Hidráulico",
        "affected": false,
        "features": []
      },
      {
        "layer_name": "vias_pecuarias",
        "display_name": "Vías pecuarias",
        "affected": false,
        "features": []
      },
      {
        "layer_name": "espacios_naturales_protegidos",
        "display_name": "Espacios Naturales Protegidos",
        "affected": true,
        "features": [
          {
            "nombre": "Parque Natural Corrubedo",
            "categoria": "Parque Natural",
            "area_interseccion_m2": 25430.5,
            "porcentaje_solape": 100.0
          }
        ]
      },
      {
        "layer_name": "masas_agua_superficial",
        "display_name": "Masas de agua superficiales",
        "affected": false,
        "features": []
      },
      {
        "layer_name": "masas_agua_subterranea",
        "display_name": "Masas de agua subterráneas",
        "affected": false,
        "features": []
      }
    ],
    "summary": {
      "total_layers_checked": 7,
      "layers_affected": 2,
      "overall_risk": "alto"
    },
    "metadata": {
      "analysis_duration_ms": 342
    }
  }
}

Risk Scoring Logic

The overall_risk field is derived from the layer intersection results. It is an indicative assessment and does not substitute a formal environmental study.
Conditionoverall_risk
0 layers affectedninguno
1–2 layers affected, all with < 10% overlapbajo
1–2 layers affected, any with ≥ 10% overlapmedio
3+ layers affected, or Red Natura 2000 / ENP with ≥ 50% overlapalto
Any intersection with Dominio Público Hidráulico, or flood zone with periodo_retorno = "T100"muy alto

curl Example

curl -X POST https://geoviable.movilab.es/api/v1/analyze \
  -H "Content-Type: application/json" \
  -d '{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-8.5449,42.8782],[-8.5400,42.8782],[-8.5400,42.8750],[-8.5449,42.8750],[-8.5449,42.8782]]]},"properties":{}}'

The frontend uses this endpoint to render a live preview of layer intersections on the map as the user draws a polygon. The /report/generate endpoint runs the full analysis independently when producing the PDF — it does not consume or cache the response from a prior /analyze call.

Build docs developers (and LLMs) love