# GeoJSON API
> Measure GeoJSON geometry on the surface of the earth. Compute the true area of a Polygon or MultiPolygon (in square metres, square kilometres, hectares, acres and square miles), find the centroid of any GeoJSON, get the bounding box (west/south/east/north) and its centre, measure the length of a LineString or MultiLineString (in kilometres, metres, miles and nautical miles), and test whether a latitude/longitude point falls inside a polygon. Accepts geometries, Features and FeatureCollections; coordinates follow the GeoJSON [longitude, latitude] order. Perfect for mapping apps, geofencing, territory and catchment analysis, route distances and spatial dashboards. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 6 endpoints. Distinct from abstract shape geometry, coordinate-format conversion, slippy map tiles and administrative-boundary data.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/geojson-api/..."
```

## Pricing
- **Free** (Free) — 980 calls/Mo, 2 req/s
- **Starter** ($2/Mo) — 8,300 calls/Mo, 8 req/s
- **Pro** ($21/Mo) — 136,000 calls/Mo, 20 req/s
- **Mega** ($57/Mo) — 700,000 calls/Mo, 50 req/s

## Endpoints

### GeoJSON

#### `GET /v1/area` — Area of a GeoJSON polygon

**Parameters:**
- `geojson` (query, required, string) — Polygon/MultiPolygon/Feature Example: `{"type":"Polygon","coordinates":[[[0,0],[0,1],[1,1],[1,0],[0,0]]]}`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/geojson-api/v1/area?geojson=%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B0%2C0%5D%2C%5B0%2C1%5D%2C%5B1%2C1%5D%2C%5B1%2C0%5D%2C%5B0%2C0%5D%5D%5D%7D"
```

**Response:**
```json
{
    "data": {
        "acres": 3061976.872801,
        "hectares": 1239139.990207,
        "square_miles": 4784.34625,
        "square_meters": 12391399902.0711,
        "square_kilometers": 12391.399902
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:47.726Z",
        "request_id": "00783958-665e-4d5d-9121-1ee6d1e7bc55"
    },
    "status": "ok",
    "message": "Area of a GeoJSON polygon",
    "success": true
}
```

#### `GET /v1/bbox` — Bounding box of a GeoJSON

**Parameters:**
- `geojson` (query, required, string) — Any GeoJSON Example: `{"type":"Polygon","coordinates":[[[0,0],[0,1],[1,1],[1,0],[0,0]]]}`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/geojson-api/v1/bbox?geojson=%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B0%2C0%5D%2C%5B0%2C1%5D%2C%5B1%2C1%5D%2C%5B1%2C0%5D%2C%5B0%2C0%5D%5D%5D%7D"
```

**Response:**
```json
{
    "data": {
        "bbox": {
            "east": 1,
            "west": 0,
            "north": 1,
            "south": 0
        },
        "center": {
            "lat": 0.5,
            "lng": 0.5
        },
        "bbox_array": [
            0,
            0,
            1,
            1
        ]
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:47.825Z",
        "request_id": "b4c3c98e-19e5-4f14-850d-374960253419"
    },
    "status": "ok",
    "message": "Bounding box of a GeoJSON",
    "success": true
}
```

#### `GET /v1/centroid` — Centroid of a GeoJSON

**Parameters:**
- `geojson` (query, required, string) — Any GeoJSON Example: `{"type":"Polygon","coordinates":[[[0,0],[0,1],[1,1],[1,0],[0,0]]]}`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/geojson-api/v1/centroid?geojson=%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B0%2C0%5D%2C%5B0%2C1%5D%2C%5B1%2C1%5D%2C%5B1%2C0%5D%2C%5B0%2C0%5D%5D%5D%7D"
```

**Response:**
```json
{
    "data": {
        "centroid": {
            "lat": 0.5,
            "lng": 0.5
        }
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:47.946Z",
        "request_id": "c8b1f62d-efbc-4692-a207-fedcc45e8a77"
    },
    "status": "ok",
    "message": "Centroid of a GeoJSON",
    "success": true
}
```

#### `GET /v1/length` — Length of a GeoJSON line

**Parameters:**
- `geojson` (query, required, string) — LineString/MultiLineString Example: `{"type":"LineString","coordinates":[[0,0],[0,1]]}`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/geojson-api/v1/length?geojson=%7B%22type%22%3A%22LineString%22%2C%22coordinates%22%3A%5B%5B0%2C0%5D%2C%5B0%2C1%5D%5D%7D"
```

**Response:**
```json
{
    "data": {
        "miles": 69.093398,
        "meters": 111195.08,
        "kilometers": 111.19508,
        "nautical_miles": 60.040562
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:48.025Z",
        "request_id": "b15386ac-4ec3-4587-b3d8-868accf4e56e"
    },
    "status": "ok",
    "message": "Length of a GeoJSON line",
    "success": true
}
```

#### `GET /v1/point-in-polygon` — Point-in-polygon test

**Parameters:**
- `lat` (query, required, string) — Latitude Example: `0.5`
- `lng` (query, required, string) — Longitude Example: `0.5`
- `polygon` (query, required, string) — GeoJSON polygon Example: `{"type":"Polygon","coordinates":[[[0,0],[0,1],[1,1],[1,0],[0,0]]]}`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/geojson-api/v1/point-in-polygon?lat=0.5&lng=0.5&polygon=%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B0%2C0%5D%2C%5B0%2C1%5D%2C%5B1%2C1%5D%2C%5B1%2C0%5D%2C%5B0%2C0%5D%5D%5D%7D"
```

**Response:**
```json
{
    "data": {
        "point": {
            "lat": 0.5,
            "lng": 0.5
        },
        "inside": true
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:48.132Z",
        "request_id": "6a9bd814-d6ba-4fb8-9da0-a5dd3204fb5a"
    },
    "status": "ok",
    "message": "Point-in-polygon test",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/geojson-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "name": "GeoJSON API",
        "notes": "Coordinates are GeoJSON order [longitude, latitude]. Area uses the spherical earth model; pass real-world WGS84 lon/lat.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/area",
                "params": {
                    "geojson": "Polygon/MultiPolygon/Feature(Collection) (required)"
                },
                "returns": "area in m², km², hectares, acres, sq miles"
            },
            {
                "path": "/v1/centroid",
                "params": {
                    "geojson": "any GeoJSON (required)"
                },
                "returns": "centroid {lat,lng}"
            },
            {
                "path": "/v1/bbox",
                "params": {
                    "geojson": "any GeoJSON (required)"
                },
                "returns": "bounding box (W/S/E/N) + center"
            },
            {
                "path": "/v1/length",
                "params": {
                    "geojson": "LineString/MultiLineString (required)"
                },
                "returns": "length in km, m, miles, nm"
            },
            {
                "path": "/v1/point-in-polygon",
                "params": {
                    "lat": "required",
                    "lng": "required",
                    "polygon": "GeoJSON polygon (required)"
                },
                "returns": "inside: true/false"
        
…(truncated, see openapi.json for full schema)
```


---
Marketplace page: https://www.oanor.com/api/geojson-api
OpenAPI spec: https://www.oanor.com/api/geojson-api/openapi.json
