Skip to content

Improve distance computation and add distance tool - #183

Open
LionelZoubritzky-IGN wants to merge 5 commits into
142-gpfschemastore0.2.0from
138/distance-tool
Open

Improve distance computation and add distance tool#183
LionelZoubritzky-IGN wants to merge 5 commits into
142-gpfschemastore0.2.0from
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.

@LionelZoubritzky-IGN
LionelZoubritzky-IGN force-pushed the 138/distance-tool branch 2 times, most recently from 5fc4332 to 9e064c5 Compare August 3, 2026 11:29
@LionelZoubritzky-IGN LionelZoubritzky-IGN linked an issue Aug 3, 2026 that may be closed by this pull request
@LionelZoubritzky-IGN
LionelZoubritzky-IGN changed the base branch from main to 142-gpfschemastore0.2.0 August 17, 2026 13:50
@LionelZoubritzky-IGN
LionelZoubritzky-IGN force-pushed the 138/distance-tool branch 2 times, most recently from 2483270 to 7c9f606 Compare August 18, 2026 14:33
@LionelZoubritzky-IGN
LionelZoubritzky-IGN marked this pull request as ready for review August 19, 2026 15:28
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 Improve distance calculation

1 participant