Urgent.News

What's breaking now, across thousands of outlets.

Tech

Matching Blood Donors by GPS: The Geospatial Query Design Behind GeoBlood

The naive version, and exactly how it fails Every geospatial feature starts life like this: ` js // do not ship this const donors = await Donor.find({ bloodType: 'B-', isAvailable: true }); const nearby = donors .map(d => ({ d, km: haversine(request.coords, d.coords) })) .filter(x => x.km <= 15) .sort((a, b) => a.km - b.km) .slice(0, 20); ` It works. It works on your laptop with 300 seeded…

The naive approach to matching blood donors by GPS fails in several ways. First, it scans the entire collection, resulting in poor performance as the registry grows. Second, it only considers a single blood type, disregarding other valuable donors. Finally, it sorts donors by proximity and stops, potentially missing the most suitable donor. MongoDB's 2dsphere index resolves these issues by modeling the Earth as a sphere and using a Hilbert curve to efficiently locate nearby donors within a specified radius.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

90POE’s OpenOcean STUDIO independently certified across major maritime emissions frameworks by Normec Verifavia

90POE (Ninety Percent of Everything Ltd), the maritime software company behind OpenOcean STUDIO, has achieved independent certification from Normec Verifavia, confirming that its platform meets the…

  • 90POE’s OpenOcean STUDIO platform certified by Normec Verifavia
  • Certification covers six major maritime emissions and fuel regulations
  • Provides independent assurance of emissions compliance accuracy

More from Friday 11 September →