Custom zones

Search zones by area

POST
/custom/layers/{layer}/zones/search

Finds the zones that meet an area.

Zone layer. Body {intersects, meta?, limit?, cursor?}: intersects (a Polygon or MultiPolygon) is required; bbox, area_id and cells are 400.

Cell layer. Give exactly one of intersects, bbox or area_id (a gp:osm: or gp:pc: Place ID). The area is turned into H3 cells at the layer's resolution. The response adds area_cells (cells in the area) and, per zone, cell_count, coverage_pct and, with cells: true, the overlapping cells.

  • An area over 500,000 cells is 413, as is a page needing over 100,000 cell IDs.
  • area_id: 404 for an unknown area.
  • Body limit 10 MB.

This is our own API, not Geoapify-compatible. Every request costs 1 rivet.

Authorization

queryapiKey<token>

Your API key from the dashboard, sent as ?apiKey=<key>.

Path Parameters

layer*string

Layer slug: lowercase letters, digits and underscores, 2 to 40 characters (^[a-z0-9_]{2,40}$).

Match^[a-z0-9_]{2,40}$

Query Parameters

geometry?string

How much geometry each zone carries: point (a representative point), geometry_1000, geometry_5000, geometry_10000 (simplified to about that many meters of tolerance) or full.

Value in"point""geometry_1000""geometry_5000""geometry_10000""full"

Request Body

application/json
  1. body

Search body. Zone layer: intersects (required); bbox, area_id and cells are rejected (400). Cell layer: exactly one of intersects, bbox or area_id.

intersects?

GeoJSON Polygon or MultiPolygon.

bbox?array<number>

Cell layers only. [west, south, east, north].

Items4 <= items <= 4
area_id?string

Cell layers only. A built-in boundary Place ID (gp:osm: or gp:pc:). 404 for an unknown area, 503 when the boundary database is not configured.

cells?boolean

Cell layers only. Include each zone's overlapping H3 cell IDs (capped at 100,000 IDs per page, else 413).

meta?

Keep zones whose metadata contains these members.

limit?integer
Range1 <= value <= 1000
Default100
cursor?string

Response Body

A page of zones.

application/json
  1. response

Zone-layer search returns a ZoneCollection. A cell-layer search adds area_cells and, per feature, cell_count, coverage_pct and (with cells: true) cells.

type*unknown
features*array<>
area_cells?integer

Cell layers only: number of cells covering the searched area.

next_cursor*string|null
Example Request
curl -X POST 'https://api.data.graphitelab.ai/v1/custom/layers/dead_zones/zones/search' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "type": "FeatureCollection",  "features": [    {      "type": "Feature",      "properties": {        "place_id": "gp:layer:zz_docs_zones:f4e920c0-89e7-4bf7-a5de-bc42e7510af2",        "boundary_type": "custom:zz_docs_zones",        "name": "Downtown demo zone",        "lookup_key": "downtown",        "metadata": {          "tier": "gold",          "population": 12000        },        "lon": -86.16,        "lat": 39.769999999999996,        "datasource": {          "sourcename": "The Graphite Lab",          "attribution": "© The Graphite Lab",          "raw": {            "layer": "zz_docs_zones",            "revision": 5          }        }      },      "geometry": {        "type": "Point",        "coordinates": [          -86.16,          39.77        ]      },      "bbox": [        -86.17,        39.76,        -86.15,        39.78      ]    }  ],  "next_cursor": null}