From fd13814d5c6b4afbef1f56d1af44a3f3964986cf Mon Sep 17 00:00:00 2001 From: Deena Sun Date: Fri, 29 Nov 2024 20:41:16 -0800 Subject: [PATCH] [chore] updated offsets for latitude and longitude --- api/webscraper/database.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/api/webscraper/database.py b/api/webscraper/database.py index 369a74a..ae9dc24 100644 --- a/api/webscraper/database.py +++ b/api/webscraper/database.py @@ -48,16 +48,16 @@ def offset_lat_long(lat, long): """ params: lat and long are floats representing the latitude and longitude of a project - Checks if there is a project within 0.01 degrees of the latitude and longitude and offsets the latitude and longitude if it overlaps with other projects + Checks if there is a project within 0.005 degrees of the latitude and longitude and offsets the latitude and longitude if it overlaps with other projects returns: newly offset latitude and longitude """ overlapping_projects = ( supabase.table(supabase_table) .select("*") - .lte("latitude", float(lat) + 0.01) - .gte("latitude", float(lat) - 0.01) - .lte("longitude", float(lat) + 0.01) - .gte("longitude", float(lat) - 0.01) + .lte("latitude", float(lat) + 0.005) + .gte("latitude", float(lat) - 0.005) + .lte("longitude", float(lat) + 0.005) + .gte("longitude", float(lat) - 0.005) .execute() ) while len(overlapping_projects.data) > 0: @@ -67,10 +67,10 @@ def offset_lat_long(lat, long): overlapping_projects = ( supabase.table(supabase_table) .select("*") - .lte("latitude", float(lat) + 0.01) - .gte("latitude", float(lat) - 0.01) - .lte("longitude", float(lat) + 0.01) - .gte("longitude", float(lat) - 0.01) + .lte("latitude", float(lat) + 0.005) + .gte("latitude", float(lat) - 0.005) + .lte("longitude", float(lat) + 0.005) + .gte("longitude", float(lat) - 0.005) .execute() ) return lat, long