Skip to content

feat: add 9 offline Turf.js geometry tools#141

Open
mattpodwysocki wants to merge 1 commit intomainfrom
feat/turf-geometry-tools
Open

feat: add 9 offline Turf.js geometry tools#141
mattpodwysocki wants to merge 1 commit intomainfrom
feat/turf-geometry-tools

Conversation

@mattpodwysocki
Copy link
Contributor

Summary

Implements all tools requested in #138. Adds 9 high-value offline geometry operations using Turf.js — no API key required, instant results, no rate limits.

New Tools

Tier 1 — High impact, fill clear gaps

Tool Description
points_within_polygon_tool Batch-test multiple points against a polygon in one call. Replaces N point_in_polygon_tool calls for delivery zone validation, fleet geofencing, etc.
union_tool Merge 2+ polygons into a single unified geometry. Useful for combining isochrones, service areas, delivery zones.
nearest_point_tool Find the closest point in a collection to a target. Replaces calling distance_tool for each candidate and sorting.

Tier 2 — Commonly useful, no current workaround

Tool Description
intersect_tool Find the intersection geometry of two polygons (the area they share).
difference_tool Subtract one polygon from another ("what is in zone A but not zone B?").
destination_tool Calculate a destination point given origin, bearing, and distance.
length_tool Measure the total length of a line/route without a routing API call.

Tier 3 — Useful for specific patterns

Tool Description
nearest_point_on_line_tool Snap a point to the nearest position on a line or route.
convex_tool Compute the convex hull of a set of points.

Test plan

  • All existing tests pass (639 tests)
  • annotations.test.ts updated with all 9 new offline tool names

Closes #138

🤖 Generated with Claude Code

Adds high-value geometry operations identified as gaps in issue #138:

Tier 1 (fill clear gaps):
- points_within_polygon_tool: batch point-in-polygon check
- union_tool: merge polygons into unified geometry
- nearest_point_tool: find closest point in a collection

Tier 2 (no current workaround):
- intersect_tool: intersection geometry of two polygons
- difference_tool: subtract one polygon from another
- destination_tool: calculate destination from bearing + distance
- length_tool: measure total length of a line

Tier 3 (specific patterns):
- nearest_point_on_line_tool: snap point to nearest position on line
- convex_tool: convex hull of a point set

All tools are pure offline Turf.js operations — no API key required,
instant results, no rate limits.

Closes #138

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mattpodwysocki mattpodwysocki requested a review from a team as a code owner March 6, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add missing high-value Turf.js offline tools

1 participant