---
id: distance_bucket_py_geo
name: distance_bucket
kind: function
lang: py
domain: geo
version: "1.0.0"
purity: pure
signature: "distance_bucket(distance_km: float) -> str"
description: "Clasifica una distancia en km en uno de los buckets: 0-5, 5-10, 10-20, 20-40, 40-80, 80-160, 160+."
tags: [geo, distance, bucket, classification, pendiente-usar]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: []
example: |
  from geo.distance_bucket import distance_bucket
  distance_bucket(3.0)    # "0-5"
  distance_bucket(7.0)    # "5-10"
  distance_bucket(200.0)  # "160+"
tested: true
tests: ["bucket_0_5", "bucket_5_10", "bucket_borde_exacto", "bucket_160_mas"]
test_file_path: "python/functions/geo/tests/test_distance_bucket.py"
file_path: "python/functions/geo/distance_bucket.py"
params:
  - {name: distance_km, desc: "distancia en kilometros a clasificar (valor >= 0)"}
output: "cadena con el rango al que pertenece la distancia, p.ej. '0-5' o '160+'"
source_repo: "internal:footprint_aurgi"
source_license: "internal-aurgi"
source_file: "zonas_mapas_aurgi/backend/app.py:678"
---

## Ejemplo

```python
from geo.distance_bucket import distance_bucket

distance_bucket(3.0)    # "0-5"
distance_bucket(50.0)   # "40-80"
distance_bucket(200.0)  # "160+"
```

## Notas

Los bordes son inclusivos por la izquierda: distance_km <= edge retorna el bucket.
