Geometry Operations API

Combine, measure, test and transform GeoJSON geometries with one POST request. Send polygons, lines or points and get back a new geometry, a number or a true/false answer. The API supports 42 operations, from union, buffer and area to point-in-polygon checks, Voronoi diagrams and k-means clustering. Every operation costs 1 credit.

Operations

The API takes GeoJSON geometries in the request body and returns one of four result types: geojson, number, boolean or empty. The 42 operations are grouped into 10 categories:

CategoryOperationsResult
Polygon set operationsunion, intersection, differenceGeoJSON
Point sets and clusteringvoronoi, clustersDbscan, clustersKmeans, concave, convex, tinGeoJSON
Spatial predicatescontains, crosses, disjoint, intersects, within, validtrue / false
Measurementdistance, length, area, pointToLineDistance, pointToPolygonDistanceNumber
Line operationspointOnLine, nearestPointOnLine, lineIntersect, alongGeoJSON or true / false
Transformationsbuffer, simplify, transformRotate, transformScale, transformTranslateGeoJSON
Geometry centerscenter, centerMean, centerMedian, centerOfMassGeoJSON
Bounding and envelopebbox, envelopeGeoJSON
Grid and random generatorsgrid, randomPoint, randomLineString, randomPolygonGeoJSON
Queries and advancedpointsWithinPolygon, greatCircle, tesselateGeoJSON

Each operation has its own input fields, for example polygon for area, geometry1 and geometry2 for contains, or polygons for union. See Supported Operations for the fields, options and a request example of every operation.

Request example

All operations use the same endpoint. The operation field selects what to do, and the other fields carry the geometries:

POST https://api.geoapify.com/v1/geometry/operation?apiKey=YOUR_API_KEY
Content-Type: application/json

For example, a store near Alexanderplatz in Berlin delivers within a rectangular zone. To check whether a customer's address is inside the zone, send the zone and the customer's location to contains. Coordinates are [longitude, latitude]:

const deliveryZone = {
  type: "Polygon",
  coordinates: [[[13.388, 52.53], [13.438, 52.53], [13.438, 52.51], [13.388, 52.51], [13.388, 52.53]]]
};

const response = await fetch("https://api.geoapify.com/v1/geometry/operation?apiKey=YOUR_API_KEY", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    operation: "contains",
    geometry1: deliveryZone,
    geometry2: { type: "Point", coordinates: [13.405, 52.52] }
  })
});

console.log(await response.json()); // {"type":"boolean","data":true}

A customer at [13.4545, 52.5096], east of the zone, gets {"type":"boolean","data":false}. With the same zone in "operation": "area" and "polygon": deliveryZone, the API returns the size in square meters, about 7.5 km²:

{ "type": "number", "data": 7523512.272821501 }

Operations that build a shape return a GeoJSON Feature. A buffer of 500 meters around the store, with "params": { "units": "meters", "steps": 4 }, returns a 16-point polygon (shortened):

{
  "type": "geojson",
  "data": {
    "type": "Feature",
    "properties": {},
    "geometry": {
      "type": "Polygon",
      "coordinates": [[[13.420590157978372, 52.52189976986668], [13.420027883158841, 52.52362057857764], ..., [13.420590157978372, 52.52189976986668]]]
    }
  }
}

Responses from requests made on 14 October 2026. Errors use HTTP status codes: 400 for invalid input or geometry, 401 for a missing or invalid API key, and 429 when the rate limit is exceeded. Try any operation without code in the Geometry Operations Playground.

Use cases

The Geometry Operations API is useful wherever an application has GeoJSON and needs an answer about it on the server, without adding a geometry library:

  • Service areas: check whether an address is inside a delivery or service zone with contains or within, and find the gaps between service areas and a target region.
  • Combining zones: merge overlapping delivery zones or isochrones with union, find their overlap with intersection, or cut one area out of another with difference.
  • Cleaning GeoJSON: validate shapes with valid before processing, and simplify large polygons and lines before you draw them on a map.
  • Measuring: get polygon areas in square meters, line lengths and distances between points or from a point to a line or polygon.
  • Grouping points: cluster customers or assets with DBSCAN or k-means, or split an area between locations with a Voronoi diagram.

Geometry tools for AI agents

The Geoapify MCP Server gives AI assistants four geometry tools based on these operations: combine_geometries, evaluate_spatial_relation, measure_geometry and transform_geometry. An agent can, for example, measure an area it built from search results or test whether a point lies inside a polygon. The MCP tools cover a subset of the operations; for all 42, call the REST API.

Geometry by ID for isolines

Some Geoapify APIs, such as the Isoline API, return an ID with each geometry they build. To combine those geometries without sending their coordinates, use the Geometry API: a GET request with operation=union or operation=intersection and two or more geometry IDs. It costs the number of geometries minus one in credits, so a union of 3 isolines costs 2 credits.

Pricing

Each request to the Geometry Operations API costs 1 credit, whatever the operation and however complex the input geometries are. The Free plan includes 3,000 credits per day, which is 3,000 operations, and no credit card is needed. See pricing plans for higher volumes and the Geometry Operations pricing in the docs.

Guides

These guides solve common tasks with the Geometry Operations API, with ready-to-run requests.

01

Prepare GeoJSON

Check and clean shapes before you process or display them.

02

Measure

Get areas and lengths in real units.

03

Combine areas

Merge, intersect, subtract and expand shapes.

04

Service areas

Check coverage for delivery and service zones.

FAQ

What is a geometry API?

A geometry API runs spatial operations on shapes for you: it merges or intersects polygons, measures areas and distances, tests whether one shape contains another, and builds new shapes such as buffers. The Geoapify Geometry Operations API does this for GeoJSON with 42 operations behind one endpoint. See the documentation.

Which data format does the Geometry Operations API use?

GeoJSON. Requests contain GeoJSON geometries with [longitude, latitude] coordinates, and results are GeoJSON, a number, or true/false. Field names depend on the operation, for example polygon for area or polygons for union; check Supported Operations.

How do I check if a point is inside a polygon?

Send "operation": "contains" with the polygon as geometry1 and the point as geometry2. The response is {"type":"boolean","data":true} when the point is inside. To check many points at once, use pointsWithinPolygon. Step by step: check whether a location is inside a service area.

How much does the Geometry Operations API cost?

Each request costs 1 credit, whatever the operation. The Free plan includes 3,000 credits per day; see pricing.

Can I combine isolines with the Geometry Operations API?

Yes. Send the isoline polygons to union or intersection. If you only have the isoline IDs returned by the Isoline API, use the ID-based Geometry API instead.

Can AI assistants use geometry operations?

Yes. Geoapify MCP Server provides four geometry tools to combine, compare, measure and transform GeoJSON geometries. Tool calls are billed like the underlying API requests.

World map

Ready to get started?

Get an API key and start now! Or try it in our Playground!