> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vangrid.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Autonomous Logistics with Vangrid Spatial Data

> Use Vangrid's real-time ground truth to power last-mile delivery robots, autonomous vehicles, and fleet coordination in dense urban environments.

Autonomous logistics platforms — delivery robots, autonomous vehicles, drone fleets — share a common dependency: they need accurate, continuously updated knowledge of the physical environment around them. Vangrid gives your systems that foundation by streaming verified spatial ground truth from a dense network of edge nodes already operating in urban environments, so your vehicles can route safely, detect obstacles in real time, and coordinate across a fleet without relying on stale map data.

## Key challenges Vangrid solves

<CardGroup cols={3}>
  <Card title="Real-time obstacle awareness" icon="triangle-exclamation">
    Detect transient obstacles — parked vehicles, construction zones, pedestrian congestion — the moment they appear, not on the next map update cycle.
  </Card>

  <Card title="Route ground truth" icon="route">
    Validate planned routes against live spatial conditions before and during traversal. Know whether a corridor is passable before your vehicle commits to it.
  </Card>

  <Card title="Multi-vehicle coordination" icon="arrows-split-up-and-left">
    Give every vehicle in your fleet access to the same real-time spatial picture so they can negotiate intersections, share lanes, and avoid redundant paths.
  </Card>
</CardGroup>

## How Vangrid fits into a logistics stack

Vangrid sits between your physical fleet and your routing or decision layer. Your vehicles issue spatial queries to define their area of interest, receive ground truth responses with confidence scores, and update their onboard world models continuously. Because Vangrid edge nodes operate at tactical urban density, even narrow corridors and interior loading docks are covered.

<Info>
  Urban-density edge node coverage is available in supported metro areas. Contact [hello@vangrid.io](mailto:hello@vangrid.io) to confirm coverage for your deployment zone.
</Info>

## Use case walkthrough: last-mile delivery corridor

The following walkthrough shows how to integrate Vangrid into a last-mile delivery system operating in a dense urban block.

<Steps>
  <Step title="Define your delivery corridor as an AOI">
    Model your delivery route as a GeoJSON polygon that encloses the street corridor your vehicle will traverse. Use a polygon tight enough to avoid pulling data from unrelated blocks, but wide enough to cover the full width of the path plus a safety margin.

    ```json delivery-corridor.json theme={null}
    {
      "type": "Polygon",
      "coordinates": [[
        [-73.9865, 40.7480],
        [-73.9845, 40.7480],
        [-73.9845, 40.7510],
        [-73.9865, 40.7510],
        [-73.9865, 40.7480]
      ]]
    }
    ```
  </Step>

  <Step title="Query spatial ground truth for the corridor">
    Submit a spatial query against `/v1/spatial/query` with your corridor polygon and a `ground_truth_score` threshold to filter out low-confidence observations. Setting `max_age_seconds` keeps the response current — for active navigation, values between 10 and 30 seconds are typical.

    <CodeGroup>
      ```bash curl theme={null}
      curl -X POST https://api.vangrid.io/v1/spatial/query \
        -H "Authorization: Bearer $VANGRID_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "aoi": {
            "type": "Polygon",
            "coordinates": [[
              [-73.9865, 40.7480],
              [-73.9845, 40.7480],
              [-73.9845, 40.7510],
              [-73.9865, 40.7510],
              [-73.9865, 40.7480]
            ]]
          },
          "max_age_seconds": 15,
          "min_ground_truth_score": 0.90
        }'
      ```

      ```python python theme={null}
      import os
      import requests

      api_key = os.environ["VANGRID_API_KEY"]

      corridor = {
          "type": "Polygon",
          "coordinates": [[
              [-73.9865, 40.7480],
              [-73.9845, 40.7480],
              [-73.9845, 40.7510],
              [-73.9865, 40.7510],
              [-73.9865, 40.7480],
          ]],
      }

      payload = {
          "aoi": corridor,
          "max_age_seconds": 15,
          "min_ground_truth_score": 0.90,
      }

      response = requests.post(
          "https://api.vangrid.io/v1/spatial/query",
          headers={
              "Authorization": f"Bearer {api_key}",
              "Content-Type": "application/json",
          },
          json=payload,
      )
      data = response.json()
      print(f"Ground truth score: {data['ground_truth_score']}")
      print(f"Observations: {len(data['data_points'])}")
      ```
    </CodeGroup>
  </Step>

  <Step title="Interpret the response">
    The response includes a top-level `ground_truth_score` for the entire AOI and individual observations from each contributing edge node. Your routing layer should inspect both the aggregate score and the spatial distribution of `data_points` to identify specific segments with blocked or degraded conditions.

    ```json theme={null}
    {
      "query_id": "q_2d7b9f4e1a3c8605",
      "timestamp": "2026-05-22T09:14:33.201Z",
      "node_count": 312,
      "ground_truth_score": 0.96,
      "geometry": {
        "type": "Polygon",
        "coordinates": [[
          [-73.9865, 40.7480],
          [-73.9845, 40.7480],
          [-73.9845, 40.7510],
          [-73.9865, 40.7510],
          [-73.9865, 40.7480]
        ]]
      },
      "data_points": [
        {
          "node_id": "node_9c3f1a",
          "lat": 40.7492,
          "lon": -73.9857,
          "observation": "clear",
          "confidence": 0.98,
          "captured_at": "2026-05-22T09:14:32.774Z",
          "provenance_hash": "sha256:b7e2d4f1a9c3605ef1d8b4a2c7f9e3b1d4a7f2c9"
        },
        {
          "node_id": "node_2a8e5c",
          "lat": 40.7501,
          "lon": -73.9851,
          "observation": "obstruction_detected",
          "confidence": 0.94,
          "captured_at": "2026-05-22T09:14:33.012Z",
          "provenance_hash": "sha256:c4f1a9e2d7b3605fa1d9c4b2f7e4a1c9d3b7f1a2"
        }
      ],
      "provenance_hash": "sha256:a1c9d3b7f4e2605fb9d1c4a2e7f3b1a9c4d7e2f1"
    }
    ```

    <Tip>
      Parse `data_points` for observations with `observation: "obstruction_detected"` and route around their coordinates before dispatching your vehicle. A `ground_truth_score` below 0.85 across the full AOI suggests the corridor has high environmental uncertainty — consider holding the vehicle until scores recover.
    </Tip>
  </Step>

  <Step title="Switch to streaming for active traversal">
    Once a vehicle is in motion, replace periodic queries with a streaming subscription so your onboard system receives updates as conditions change rather than on a fixed polling interval.

    ```python python theme={null}
    import os
    import json
    import requests

    api_key = os.environ["VANGRID_API_KEY"]

    params = {
        "geometry": "POLYGON((-73.9865 40.7480,-73.9845 40.7480,-73.9845 40.7510,-73.9865 40.7510,-73.9865 40.7480))",
        "ground_truth_score_min": "0.90",
    }

    with requests.get(
        "https://api.vangrid.io/v1/spatial/stream",
        headers={
            "Authorization": f"Bearer {api_key}",
            "Accept": "text/event-stream",
        },
        params=params,
        stream=True,
    ) as response:
        for line in response.iter_lines():
            if line:
                event = json.loads(line.decode("utf-8").lstrip("data: "))
                # Feed each update into your onboard world model
                process_spatial_update(event)
    ```
  </Step>
</Steps>

## Relevant concepts

<CardGroup cols={3}>
  <Card title="Edge nodes" icon="network-wired" href="/concepts/edge-nodes">
    How urban-density edge node coverage is structured and how nodes are selected for your queries.
  </Card>

  <Card title="Continuous ground truth" icon="circle-check" href="/concepts/ground-truth">
    What `ground_truth_score` means, how it is calculated, and when to trust or reject a response.
  </Card>

  <Card title="Data pipeline" icon="arrow-right-arrow-left" href="/concepts/data-pipeline">
    How data moves from edge capture through multi-view ingestion to your API response.
  </Card>
</CardGroup>
