spatial_calc
Compute deterministic geometric relations, point-in-polygon tests with holes, Haversine distance and bearing, or split bounding boxes into grids for chunked queries offline.
Instructions
Perform deterministic offline geometric calculations on bounding boxes, points, and polygons (with holes, zero network calls): 'relation' (intersects, contains, overlap area %, union & intersection bbox between two geometries), 'point_in_geometry' (check if a point is inside a bbox or WKT/GeoJSON polygon respecting interior holes), 'distance_bearing' (exact Haversine distance, initial compass bearing, and midpoint between two points), or 'split_grid' (subdivide a bbox into an N x M grid of sub-bboxes for chunked queries).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cols | No | Number of longitude columns for 'split_grid' (1-20, default 2). | |
| rows | No | Number of latitude rows for 'split_grid' (1-20, default 2). | |
| point | No | Point coordinates 'lat,lng' to test in 'point_in_geometry'. | |
| bbox_a | Yes | First geometry / bounding box (for 'relation', 'point_in_geometry', 'split_grid') or origin point 'lat,lng' (for 'distance_bearing'). | |
| bbox_b | No | Second geometry / bounding box (for 'relation') or destination point 'lat,lng' (for 'distance_bearing'). | |
| operation | Yes | The geometric operation to perform. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | ||
| bbox | No | ||
| cols | No | ||
| from | No | ||
| rows | No | ||
| cells | No | ||
| point | No | ||
| inside | No | ||
| complete | Yes | ||
| midpoint | No | ||
| warnings | Yes | ||
| operation | Yes | ||
| share_url | Yes | ||
| area_a_km2 | No | ||
| area_b_km2 | No | ||
| intersects | No | ||
| provenance | Yes | ||
| union_bbox | No | ||
| distance_km | No | ||
| inside_bbox | No | ||
| target_bbox | No | ||
| total_cells | No | ||
| a_contains_b | No | ||
| b_contains_a | No | ||
| original_bbox | No | ||
| inside_polygon | No | ||
| union_area_km2 | No | ||
| bearing_degrees | No | ||
| distance_meters | No | ||
| intersection_bbox | No | ||
| cardinal_direction | No | ||
| overlap_percent_of_a | No | ||
| overlap_percent_of_b | No | ||
| intersection_area_km2 | No | ||
| centroid_distance_meters | No |