Skip to content

Commit

Permalink
[chore] updated offsets for latitude and longitude
Browse files Browse the repository at this point in the history
  • Loading branch information
deenasun committed Nov 30, 2024
1 parent ae2ab30 commit fd13814
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions api/webscraper/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit fd13814

Please sign in to comment.