r/apachespark • • 23h ago

PostGIS vs Apache Sedona for a real-time, multi-city routing app — justified or overkill at this scale?

0 Upvotes

Context

I'm building a heat-aware ("cool") pedestrian routing app. The idea: encode "hot street → slow street" so a routing engine's fastest-path search returns the coolest path. Every ~10 minutes a background worker reads live air temperatures (per-city value + a set of point sensors), interpolates a temperature per street (inverse-distance weighting), converts it to a walking speed, and feeds per-city speed files to the routing engine. It's designed for multiple cities from the start (currently 2, targeting ~10–20).

The stack is Dockerized: routing engine + Python updater + PostGIS + a small API + web map.

Current data layer (PostGIS)

PostGIS stores the spatial data and answers the spatial queries:

  • sensor_readings — point sensors with timestamped temperatures. ~30–80 sensors per city (adjust), a new reading per sensor every ~10 min.
  • cool_centres — a few dozen refuge points per city.
  • Typical queries: nearest cool centres within a radius (ST_DWithin / ST_Distance / ST_MakePoint), and latest reading per sensor.

So the workload is real-time, read-mostly, small-to-moderate (thousands of rows per city, not millions), with frequent small updates.

The question

I was also looking at the possibilikty of using Apache Sedona. From what I understand, Sedona offers the same ST_* functions but is built for distributed, large-scale spatial processing on Spark/Flink — millions+ of geometries on a cluster.

Given my scale (a handful of cities, tens–hundreds of sensors each, real-time 10-minute updates, simple proximity queries):

  1. Is Apache Sedona justified here, or is it overkill vs plain PostGIS?
  2. At roughly what data scale / workload would Sedona start to pay off over PostGIS?
  3. If I later scale to many more cities/sensors, is there a clean migration path, or a hybrid setup people use (e.g. PostGIS for live/transactional, Sedona for large offline/batch analytics)?

Thanks — trying to make an informed architecture decision rather than add Spark just because it's available