Filter hubs to rail/sea and add graph-based nearest
All checks were successful
Build Docker Image / build (push) Successful in 3m9s

This commit is contained in:
Ruslan Bakiev
2026-02-05 18:41:07 +07:00
parent 387abf03e4
commit 09324bb25e
2 changed files with 108 additions and 7 deletions

View File

@@ -81,11 +81,18 @@ def _fetch_nodes(db, west, south, east, north, transport_type=None, node_type=No
nodes = list(cursor)
# Filter by transport type if specified (only for logistics nodes)
if transport_type and node_type in (None, 'logistics'):
nodes = [
n for n in nodes
if transport_type in (n.get('transport_types') or [])
]
if node_type in (None, 'logistics'):
if transport_type:
nodes = [
n for n in nodes
if transport_type in (n.get('transport_types') or [])
]
else:
# Default: only rail/sea hubs
nodes = [
n for n in nodes
if ('rail' in (n.get('transport_types') or [])) or ('sea' in (n.get('transport_types') or []))
]
return nodes
@@ -151,4 +158,3 @@ def get_clustered_nodes(db, west, south, east, north, zoom, transport_type=None,
logger.info("Returning %d clusters/points for zoom=%d res=%d", len(results), zoom, resolution)
return results