Skip to content

Improve distance computation and add distance tool - #183

Draft
LionelZoubritzky-IGN wants to merge 5 commits into
mainfrom
138/distance-tool
Draft

Improve distance computation and add distance tool#183
LionelZoubritzky-IGN wants to merge 5 commits into
mainfrom
138/distance-tool

Conversation

@LionelZoubritzky-IGN

Copy link
Copy Markdown
Contributor

Replace the previous distance helper implementation with a turf-based implementation.

Also add a distance tool to expose this primitive to the LLM for the specific case of point-to-point computation. This tool works with four different profiles:

  • direct: distance as the crow flies (close Distance between two points tool #138).
  • vincenty for high-precision ellipsoid distance.
  • car and pedestrian: distances along an itinerary, computed with the Geoplateforme.

With the two latest mode, the time of travel is also returned. The itinerary can be chosen as the shortest time or the shortest distance.

Replaces #156 (updated algorithm and this PR is easier to maintain because it does not rely on my fork)

@LionelZoubritzky-IGN LionelZoubritzky-IGN changed the title 138/distance tool Improve distance computation and add distance tool Jul 28, 2026
@LionelZoubritzky-IGN
LionelZoubritzky-IGN force-pushed the 138/distance-tool branch 2 times, most recently from a0ce3c6 to 95059e1 Compare July 29, 2026 16:50
@LionelZoubritzky-IGN

Copy link
Copy Markdown
Contributor Author

In the current state, all distance tests pass except a few edge cases where an ill-formed polygon circles around a pole. Those are marked as expected failures because I'm not sure it's really possible to do better without introducing a LOT of new code dedicated to the analysis of this special case... which does not seem worth it (the case of a well-formed polygon does work).

If you are curious though, there is a vibe-coded version in the https://github.com/ignfab/geocontext/tree/138/PROJECTIONS/distance-tool branch.

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.

Distance between two points tool

1 participant