---
title: "Run a spatial analysis"
method: POST
path: "/analyze"
tags: ["compute"]
---

# Run a spatial analysis

`POST /analyze`

## Request

- Base URL: `https://api.mapsource.io`
- URL: `https://api.mapsource.io/analyze`
- Auth: HTTP bearer

Buffer, centroid, bbox, area, length, distance, intersect, union, difference, contains, intersects, nearest, simplify and convex hull.

When to use: Measure or transform GeoJSON, coordinates, query results, and result handles.

When not to use: Use a pipeline for several dependent operations in one request.

## Request body

- object
  - `operation` 'buffer' | 'centroid' | 'bbox' | 'area' | 'length' | 'distance' | 'intersect' | 'union' | 'difference' | 'contains' | 'intersects' | 'nearest' | 'simplify' | 'convex', required: The operation to run.
  - `a` object, required: GeoJSON, a [lon, lat] pair, a query or places result, or a result handle.
  - `b` object: Second operand, in the same forms as a.
  - `distance` number: Buffer radius or simplify tolerance.
  - `units` 'meters' | 'kilometers' | 'miles': Units for distance.

## Response `200`

Run a spatial analysis

- object
  - `schema` string
  - `operation` string
  - `geometry` unknown
  - `value` unknown
  - `bbox` unknown
  - `meta` object
    - `requestId` string
    - `computeMs` integer
    - `requestedAt` string, date-time
    - `sources` object[]
      - `dataset` string
      - `observedAt` string, nullable
      - `license` string
    - `freshness` object, nullable
    - `licenses` string[]
    - `attribution` string[]

## Other responses

- `400`: Error with a stable machine code.
- `401`: Error with a stable machine code.
- `429`: Error with a stable machine code.
- `500`: Error with a stable machine code.

---

[API](https://skmtc.dev/mapsource/apis/mapsource-overpass-api.md) · [All operations](https://skmtc.dev/mapsource/apis/mapsource-overpass-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mapsource/apis/mapsource-overpass-api/revisions/8af8c2769e7b?raw)
