calculate_manhattan_distance {Tivy}R Documentation

Calculate Manhattan distance between coordinates

Description

Internal function to calculate Manhattan distance (L1 norm) between coordinates, adapted for geographic coordinate systems.

Usage

calculate_manhattan_distance(lon1, lat1, lon2, lat2, unit)

Arguments

lon1

Origin longitude.

lat1

Origin latitude.

lon2

Destination longitude vector.

lat2

Destination latitude vector.

unit

Distance unit: "nm" or "km".

Details

The Manhattan distance calculates the sum of absolute differences between coordinates, adapted for geographic coordinates using spherical projection approximations. This implementation accounts for Earth's curvature by applying latitude corrections to longitude differences.

Value

List with minimum distance and corresponding index.

Note

This implementation adapts the standard Manhattan distance metric for geographic coordinate systems by incorporating Earth's radius and latitude corrections.


[Package Tivy version 0.1.1 Index]