47fac22230
- .claude/CLAUDE.md - .claude/commands/subagentes.md - .claude/rules/INDEX.md - .mcp.json - bash/functions/cybersecurity/analyze_dns.md - bash/functions/cybersecurity/audit_http_headers.md - bash/functions/cybersecurity/audit_ssh_config.md - bash/functions/cybersecurity/check_firewall.md - bash/functions/cybersecurity/detect_suspicious_users.md - bash/functions/cybersecurity/encrypt_file.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
48 lines
1.5 KiB
Markdown
48 lines
1.5 KiB
Markdown
---
|
|
id: haversine_km_py_geo
|
|
name: haversine_km
|
|
kind: function
|
|
lang: py
|
|
domain: geo
|
|
version: "1.0.0"
|
|
purity: pure
|
|
signature: "haversine_km(lon1: float, lat1: float, lon2: float, lat2: float) -> float"
|
|
description: "Calcula la distancia en kilometros entre dos puntos lon/lat usando la formula de Haversine con R=6371.0."
|
|
tags: [geo, distance, haversine, coordinates, pendiente-usar]
|
|
uses_functions: []
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: ""
|
|
imports: ["math"]
|
|
example: |
|
|
from geo.haversine_km import haversine_km
|
|
d = haversine_km(-3.7038, 40.4168, 2.1686, 41.3874) # Madrid -> Barcelona ~504 km
|
|
tested: true
|
|
tests: ["madrid_barcelona_aproximado", "misma_coordenada_es_cero"]
|
|
test_file_path: "python/functions/geo/tests/test_haversine_km.py"
|
|
file_path: "python/functions/geo/haversine_km.py"
|
|
params:
|
|
- {name: lon1, desc: "longitud del primer punto en grados decimales"}
|
|
- {name: lat1, desc: "latitud del primer punto en grados decimales"}
|
|
- {name: lon2, desc: "longitud del segundo punto en grados decimales"}
|
|
- {name: lat2, desc: "latitud del segundo punto en grados decimales"}
|
|
output: "distancia en kilometros entre los dos puntos"
|
|
source_repo: "internal:footprint_aurgi"
|
|
source_license: "internal-aurgi"
|
|
source_file: "zonas_mapas_aurgi/backend/app.py:668"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```python
|
|
from geo.haversine_km import haversine_km
|
|
|
|
d = haversine_km(-3.7038, 40.4168, 2.1686, 41.3874)
|
|
# d ≈ 504.0 km
|
|
```
|
|
|
|
## Notas
|
|
|
|
Funcion pura. Usa R=6371.0 km (radio medio de la Tierra). No maneja NaN ni Inf.
|