Get the extent of a geometry or a whole collection: a map viewport, a tile query window, a
Get the extent of a geometry or a whole collection: a map viewport, a tile query window, a cheap prefilter before you pay for a containment test. Takes any geometry type, not just polygons. Bounding box of any geometry as [minLongitude, minLatitude, maxLongitude, maxLatitude]. Naive minimum and maximum per axis, so a geometry spanning the antimeridian reports a full-width longitude range rather than the narrow band it occupies; the response flags that case instead of guessing which side you meant. Input is EPSG:4326 only. Limits: 100000 positions across the whole document, 1 MiB request body.
Provider
api.geoprimitives.dev · discovered, not yet claimed by its owner
Payment (x402 accepts[])
[
{
"scheme": "exact",
"network": "eip155:8453",
"payTo": "0x76A51b5Dd3729950B3b60c17f19252d221968FCe",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amount": "10000",
"maxTimeoutSeconds": 300
}
]Output schema
{
"bazaar": {
"info": {
"input": {
"body": {
"geojson": {
"coordinates": [
[
[
-150,
61
],
[
-149.9,
61
],
[
-149.9,
61.05
],
[
-150,
61.05
],
[
-150,
61
]
]
],
"type": "Polygon"
}
},
"bodyType": "json",
"method": "POST",
"type": "http"
},
"output": {
"example": {
"bbox": [
-150,
61,
-149.9,
61.05
],
"inputVertices": 5,
"notes": [],
"op": "bbox"
},
"type": "json"
}
},
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"input": {
"additionalProperties": false,
"properties": {
"body": {
"additionalProperties": false,
"properties": {
"geojson": {
"description": "A GeoJSON Feature, FeatureCollection or Geometry in EPSG:4326, longitude then latitude in degrees. At most 100000 positions across the whole document.",
"type": "object"
}
},
"required": [
"geojson"
],
"type": "object"
},
"bodyType": {
"enum": [
"json",
"form-data",
"text"
],
"type": "string"
},
"method": {
"enum": [
"POST"
],
"type": "string"
},
"type": {
"const": "http",
"type": "string"
}
},
"required": [
"type",
"method",
"bodyType",
"body"
],
"type": "object"
},
"output": {
"properties": {
"example": {
"type": "object"
},
"type": {
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
}
},
"required": [
"input"
],
"type": "object"
}
}
}Use it
curl
curl "https://api.geoprimitives.dev/v1/geometry/bbox" # -> 402 Payment Required, accepts[] lists how to pay # retry with a PAYMENT-SIGNATURE (or PAYMENT header) once paid
JavaScript
const res = await fetch("https://api.geoprimitives.dev/v1/geometry/bbox");
if (res.status === 402) {
const { accepts } = await res.json();
// pay one of accepts[] via an x402 client, then retry with the payment header
}Python
import httpx
res = httpx.get("https://api.geoprimitives.dev/v1/geometry/bbox")
if res.status_code == 402:
accepts = res.json()["accepts"]
# pay one of accepts[] via an x402 client, then retry with the payment headerMachine-readable
Everything on this page is also available as clean JSON at /resources/6762.json, and this resource appears in /discovery/resources and /discovery/search.