DEV Community

William Rodriguez
William Rodriguez

Posted on

Geospatial queries in microseconds: Redis Geo steps in wpipe.

You don't need a heavy PostGIS database cluster just to calculate proximity between a courier and a customer. wpipe-steps makes Redis geospatial distance and radius queries a 1-line pipeline step.

Here is how you use Redis Geo Spatial Steps in a production pipeline with wpipe-steps:

from wpipe import Pipeline
from wpipe_steps.database.redis.geo import (
    redis_geo_add_sync,
    redis_geo_get_distance_sync
)

pipeline = Pipeline(pipeline_name="logistics_routing")

pipeline.set_steps([
    # Store warehouse and delivery target
    redis_geo_add_sync.as_step(
        name="set_locations",
        key="fleet:locations",
        longitude=-3.7038, latitude=40.4168, member="Madrid_Hub"
    ),
    # Calculate exact distance
    redis_geo_get_distance_sync.as_step(
        name="calc_distance",
        key="fleet:locations",
        member1="Madrid_Hub", member2="Toledo_Dropoff",
        unit="km",
        response_key="route_km"
    )
])

result = pipeline.run({})
print(f"Calculated distance: {result.get('route_km')} km")
Enter fullscreen mode Exit fullscreen mode

Why developers love wpipe-steps:

  • 196 cataloged steps covering Redis, ClickHouse, MySQL, WAF, S3, Docker, and local HuggingFace AI.
  • Lazy-loading imports for instant sub-100ms startup times.
  • Clean .as_step() factory interface.

Check out the full repository on GitHub!

Top comments (0)