# Route Overlap & Divergence Calculator AI Agent Connect

> Route Overlap & Divergence Calculator MCP lets your AI client perform precise spatial analysis on movement data. You can measure how much two paths share a physical route, calculate geometric separation, and check if trajectories move in the same direction. It turns raw coordinate data into actionable spatial insights for any agent-based workflow.

## Overview
- **Category:** data-analysis
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_fVnbd2Bqr1WiG1uNlPAy21o2jOC5olr9rShPskuD/ai-agent-connect
- **Tags:** gis, routes, spatial, geometry, trajectory

## Description

You can now give your AI agent the ability to understand spatial relationships between different paths. Instead of guessing how similar two routes are, you can use this MCP to get exact numbers on overlap and divergence. It works by processing coordinate sequences to determine if paths are physically identical, slightly offset, or moving in completely different directions. 

You can synchronize paths that don't perfectly line up using segment alignment, making it easier to compare a planned route against an actual one. Whether you are looking at vehicle telemetry, walking paths, or drone trajectories, this tool provides the geometric math needed to validate movement. Your agent can use these metrics to flag deviations, confirm route adherence, or identify where two travelers diverged from a shared path.

## Tools

### align_route_segments
This tool creates a synchronized sequence of segments so you can compare two paths side by side.

### analyze_route_overlap
Use this to find out how much two routes share the same physical path, with an optional meter-based tolerance.

### calculate_spatial_divergence
This tool measures the geometric separation between two different routes.

### evaluate_directional_agreement
This tool checks if two routes are heading in the same direction during similar stages of their journey.

## Prompt Examples

**Prompt:** 
```
Compare these two routes: routeA: [{"lat": 40.7128, "lng": -74.0060}, {"lat": 40.7138, "lng": -74.0070}] and routeB: [{"lat": 40.7128, "lng": -74.0060}, {"lat": 40.7138, "lng": -74.0070}]
```

**Response:** 
```
The routes are identical with a shared distance of approximately 141 meters and an overlap ratio of 1.0.
```

**Prompt:** 
```
Calculate the spatial divergence between routeA: [{"lat": 34.0522, "lng": -118.2437}, {"lat": 34.0532, "lng": -118.2447}] and routeB: [{"lat": 34.0552, "lng": -118.2467}, {"lat": 34.0562, "lng": -118.2477}]
```

**Response:** 
```
The Hausdorff distance between the two routes is approximately 350 meters.
```

**Prompt:** 
```
Check the directional agreement for routeA: [{"lat": 51.5074, "lng": -0.1278}, {"lat": 51.5084, "lng": -0.1288}] and routeB: [{"lat": 51.5074, "lng": -0.1278}, {"lat": 51.5064, "lng": -0.1268}]
```

**Response:** 
```
The agreement score is 0.0, as the routes are moving in opposite directions.
```

## Capabilities

### Path Overlap Detection
Your agent uses this to see if two sets of coordinates cover the same ground.

### Geometric Separation
Your agent calculates the distance between two trajectories using spatial divergence math.

### Heading Consistency
Your agent evaluates if two paths maintain the same direction over time.

### Route Synchronization
The tool aligns segments to make non-identical paths comparable.

## Use Cases

### Route Adherence Audits
Compare a driver's GPS trace against a pre-defined route to find deviations.

### Trajectory Similarity Testing
Measure how closely a drone or autonomous vehicle follows a specific flight path.

### Spatial Pattern Analysis
Determine if multiple travelers are following the same corridors through a city.

### Path Alignment
Align two different datasets of the same journey to compare them accurately.

## Benefits

- Replaces manual geometric calculations with direct tool calls.
- Provides mathematical certainty for route similarity instead of visual estimation.
- Enables automated detection of path deviations.
- Synchronizes mismatched paths for fair comparison.

## How It Works

Getting spatial insights is a direct process from connection to calculation.

1. Connect your preferred MCP-compatible client to Vinkius.
2. Provide your route coordinate data to your AI agent.
3. Ask your agent to perform a specific analysis like overlap or divergence.
4. Your agent calls the appropriate tool from this MCP.
5. Your agent receives the mathematical result and explains it to you.

## Frequently Asked Questions

**How do I use this MCP with Claude?**
You connect your Claude client to Vinkius once. After that, the tools are immediately available for your agent to use in any conversation.

**Can I specify a distance tolerance for overlap?**
Yes, the analyze_route_overlap tool allows you to provide a tolerance in meters to define how close paths must be to count as overlapping.

**What kind of data does this MCP need?**
The tools require route data, typically provided as sequences of latitude and longitude coordinates.

**Does this work for non-driving routes?**
Yes, it works for any trajectory data, including walking paths, drone flights, or any movement recorded via coordinates.

**Is there a way to compare paths that aren't perfectly aligned?**
Yes, you can use the align_route_segments tool to synchronize paths into comparable segments before running other analyses.

**How do I compare two GPS tracks?**
You can use `analyze_route_overlap` to find the shared distance and unique segments between two GPS tracks provided as coordinate arrays.

**Can I measure how far apart two routes are?**
Yes, `calculate_spatial_divergence` provides Hausdorff distance and average separation to quantify the geometric gap between routes.

**How do I check if two vehicles are heading in the same direction?**
Use `evaluate_directional_agreement` to get an agreement score and mean heading difference for the two routes.
