Difference of Polygons
difference_toolSubtract one polygon from another to compute exclusion zones or areas in zone A not covered by zone B, returning null if fully covered.
Instructions
Subtract one polygon from another, returning the area in polygon1 that is not covered by polygon2. Useful for computing exclusion zones, finding uncovered service areas, or "what is in zone A but not zone B?". Returns null geometry if polygon2 fully covers polygon1. Works offline without API calls. INPUT SHAPE: polygon1 and polygon2 are each an array of rings; each ring is an array of [lng, lat] pairs. When chaining with isochrone_tool, extract feature.geometry.coordinates from each isochrone Feature (with polygons=true).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"polygon1": "<polygon1>",
"polygon2": "<polygon2>"
},
"name": "difference_tool"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| polygon1 | Yes | The polygon to subtract from | |
| polygon2 | Yes | The polygon to subtract |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geometry | Yes | GeoJSON geometry of the remaining area (polygon1 minus polygon2), or null if polygon2 fully covers polygon1 | |
| mapboxRender | No | Map-payload reference for `render_map_tool`. Surfaced so the LLM can chain the next call without re-emitting geometry. | |
| has_difference | Yes | Whether any area remains after subtracting polygon2 from polygon1 |