Transform Geometry
The transform_geometry MCP tool buffers, simplifies, rotates, scales, translates, or calculates centers for a GeoJSON geometry.
Use this tool to derive a new geometry from an existing geometry or calculate a representative center point.
Tool name
transform_geometry
Request URL
https://api.geoapify.com/v1/mcp?apiKey=YOUR_API_KEY
Input parameters
| Name | Type | Required | Description |
|---|---|---|---|
operation |
string | Yes | buffer, simplify, rotate, scale, translate, center, center_mean, center_median, or center_of_mass. |
geometry |
GeoJSON geometry | Yes | Geometry to transform or use for the center calculation. |
distance |
number | Conditionally | Buffer radius or translation distance. Required for buffer and translate. |
units |
string | No | Buffer or translation distance units. Default: kilometers. |
steps |
integer | No | Circular arc segments per quadrant for buffer, from 1 to 128. Default: 8. |
tolerance |
number | No | Non-negative simplification tolerance for simplify. Default: 1. |
high_quality |
boolean | No | Set to true to use the slower, higher-quality simplification algorithm. Default: false. |
angle |
number | Conditionally | Clockwise rotation in degrees. Required for rotate. |
pivot |
array | No | Rotation pivot in [longitude, latitude] order. Defaults to the geometry centroid. |
factor |
number | Conditionally | Positive scale multiplier. Required for scale. |
origin |
string or array | No | Scale origin: center, centroid, sw, se, nw, ne, or a [longitude, latitude] position. |
direction |
number | Conditionally | Translation direction in decimal degrees, where 0 is north and 90 is east. Required for translate. |
z_translation |
number | No | Translation applied to the optional third coordinate. |
Supported distance units are meters, metres, millimeters, millimetres, centimeters, centimetres, kilometers, kilometres, miles, nauticalmiles, inches, yards, feet, radians, and degrees.
Coordinates use WGS84 [longitude, latitude, optional elevation] order. Each operation accepts only its operation-specific fields. Center operations accept only operation and geometry; the input schema does not allow additional properties.
Operations
| Operation | Input | Output |
|---|---|---|
buffer |
Geometry, distance, optional units and steps | Buffer GeoJSON or an empty result |
simplify |
Geometry, optional tolerance and quality | Simplified GeoJSON |
rotate |
Geometry, angle, optional pivot | Rotated GeoJSON |
scale |
Geometry, factor, optional origin | Scaled GeoJSON |
translate |
Geometry, distance, direction, optional units | Translated GeoJSON |
center |
Geometry | Bounding-box center Point |
center_mean |
Geometry | Mean-center Point |
center_median |
Geometry | Median-center Point |
center_of_mass |
Geometry | Center-of-mass Point |
Example request
{
"jsonrpc": "2.0",
"id": 4,
"method": "tools/call",
"params": {
"name": "transform_geometry",
"arguments": {
"operation": "center",
"geometry": {
"type": "Point",
"coordinates": [13.405, 52.52]
}
}
}
}
Response
The tool returns structuredContent.type as geojson and the transformed geometry or calculated center in structuredContent.data. A transformation with no result returns type: "empty" and data: null.
Example response
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"content": [{ "type": "text", "text": "{\"type\":\"geojson\",\"data\":{\"type\":\"Feature\",\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[13.405,52.52]}}}" }],
"structuredContent": {
"type": "geojson",
"data": {
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [13.405, 52.52]
}
}
},
"isError": false
}
}
Related tools
- Combine Geometries - intersect, subtract, merge, or envelope geometries.
- Measure Geometry - calculate numeric measurements or locate points on geometries.
Related API
For direct HTTP API integration, see Geometry Operations API.
buffer
Use buffer with transform_geometry to create a polygon around a geometry at a specified radius.
Input
| Field | Type | Required | Description |
|---|---|---|---|
operation |
string | Yes | Must be buffer. |
geometry |
GeoJSON geometry | Yes | Geometry to buffer. |
distance |
number | Yes | Buffer radius in the selected units. |
units |
string | No | Distance units. Default: kilometers. |
steps |
integer | No | Arc segments per quadrant, from 1 to 128. Default: 8. |
Arguments example
{
"operation": "buffer",
"geometry": { "type": "Point", "coordinates": [13.405, 52.52] },
"distance": 500,
"units": "meters",
"steps": 16
}
Output
type: "geojson"with the buffer Polygon or MultiPolygon Feature indata.type: "empty"withdata: nullwhen no buffer geometry is produced.
simplify
Use simplify with transform_geometry to reduce geometry complexity while preserving its general shape.
Input
| Field | Type | Required | Description |
|---|---|---|---|
operation |
string | Yes | Must be simplify. |
geometry |
GeoJSON geometry | Yes | Geometry to simplify. |
tolerance |
number | No | Non-negative simplification tolerance. Default: 1. |
high_quality |
boolean | No | Use the slower, higher-quality algorithm. Default: false. |
Arguments example
{
"operation": "simplify",
"geometry": { "type": "LineString", "coordinates": [[13.38, 52.5], [13.39, 52.512], [13.405, 52.52], [13.42, 52.531], [13.44, 52.54]] },
"tolerance": 0.001,
"high_quality": true
}
Output
Returns type: "geojson" with the simplified geometry Feature in data.
rotate
Use rotate with transform_geometry to rotate a geometry clockwise around a pivot.
Input
| Field | Type | Required | Description |
|---|---|---|---|
operation |
string | Yes | Must be rotate. |
geometry |
GeoJSON geometry | Yes | Geometry to rotate. |
angle |
number | Yes | Clockwise rotation angle in degrees. |
pivot |
array | No | [longitude, latitude] pivot. Defaults to the geometry centroid. |
Arguments example
{
"operation": "rotate",
"geometry": { "type": "Polygon", "coordinates": [[[13.38, 52.5], [13.42, 52.5], [13.42, 52.54], [13.38, 52.54], [13.38, 52.5]]] },
"angle": 45,
"pivot": [13.4, 52.52]
}
Output
Returns type: "geojson" with the rotated geometry Feature in data.
scale
Use scale with transform_geometry to resize a geometry by a positive multiplier.
Input
| Field | Type | Required | Description |
|---|---|---|---|
operation |
string | Yes | Must be scale. |
geometry |
GeoJSON geometry | Yes | Geometry to scale. |
factor |
number | Yes | Positive scale multiplier. |
origin |
string or array | No | center, centroid, sw, se, nw, ne, or [longitude, latitude]. |
Arguments example
{
"operation": "scale",
"geometry": { "type": "Polygon", "coordinates": [[[13.38, 52.5], [13.42, 52.5], [13.42, 52.54], [13.38, 52.54], [13.38, 52.5]]] },
"factor": 1.5,
"origin": "center"
}
Output
Returns type: "geojson" with the scaled geometry Feature in data.
translate
Use translate with transform_geometry to move a geometry by a distance and compass direction.
Input
| Field | Type | Required | Description |
|---|---|---|---|
operation |
string | Yes | Must be translate. |
geometry |
GeoJSON geometry | Yes | Geometry to move. |
distance |
number | Yes | Translation distance in the selected units. |
direction |
number | Yes | Direction in degrees: 0 is north and 90 is east. |
units |
string | No | Distance units. Default: kilometers. |
z_translation |
number | No | Translation applied to an optional third coordinate. |
Arguments example
{
"operation": "translate",
"geometry": { "type": "Point", "coordinates": [13.405, 52.52] },
"distance": 500,
"direction": 90,
"units": "meters"
}
Output
Returns type: "geojson" with the translated geometry Feature in data.
center
Use center with transform_geometry to return the center of a geometry's bounding box.
Input
| Field | Type | Required | Description |
|---|---|---|---|
operation |
string | Yes | Must be center. |
geometry |
GeoJSON geometry | Yes | Geometry whose bounding-box center should be calculated. |
Arguments example
{
"operation": "center",
"geometry": { "type": "Polygon", "coordinates": [[[13.38, 52.5], [13.42, 52.5], [13.42, 52.54], [13.38, 52.54], [13.38, 52.5]]] }
}
Output
Returns type: "geojson"; data is the Point Feature at the center of the geometry bounding box.
center_mean
Use center_mean with transform_geometry to calculate the arithmetic mean of all geometry vertices.
Input
| Field | Type | Required | Description |
|---|---|---|---|
operation |
string | Yes | Must be center_mean. |
geometry |
GeoJSON geometry | Yes | Geometry whose mean center should be calculated. |
Arguments example
{
"operation": "center_mean",
"geometry": { "type": "LineString", "coordinates": [[13.38, 52.5], [13.41, 52.53], [13.44, 52.54]] }
}
Output
Returns type: "geojson"; data is the mean-center Point Feature.
center_median
Use center_median with transform_geometry to find the center that minimizes total distance to the input vertices.
Input
| Field | Type | Required | Description |
|---|---|---|---|
operation |
string | Yes | Must be center_median. |
geometry |
GeoJSON geometry | Yes | Geometry whose median center should be calculated. |
Arguments example
{
"operation": "center_median",
"geometry": { "type": "MultiPoint", "coordinates": [[13.38, 52.5], [13.405, 52.52], [13.44, 52.54]] }
}
Output
Returns type: "geojson"; data is the median-center Point Feature.
center_of_mass
Use center_of_mass with transform_geometry to calculate a geometry's center of mass.
Input
| Field | Type | Required | Description |
|---|---|---|---|
operation |
string | Yes | Must be center_of_mass. |
geometry |
GeoJSON geometry | Yes | Geometry whose center of mass should be calculated. |
Arguments example
{
"operation": "center_of_mass",
"geometry": { "type": "Polygon", "coordinates": [[[13.38, 52.5], [13.43, 52.5], [13.42, 52.55], [13.38, 52.54], [13.38, 52.5]]] }
}
Output
Returns type: "geojson"; data is the center-of-mass Point Feature.