Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions api/src/osm/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ async def getWorkspaceBBox(
text(f"SET search_path TO 'workspace-{int(workspace_id)}', public")
)

sql_query = text("select MAX(latitude) AS max_lat, MAX(longitude) AS max_lon, \
MIN(latitude) AS min_lat, MIN(longitude) AS min_lon from nodes")
# OSM stores node latitude/longitude as integers scaled by 1e7
# (100-nanodegree units), so divide by 1e7 to return decimal degrees.
sql_query = text(
"select MAX(latitude) / 1e7 AS max_lat, MAX(longitude) / 1e7 AS max_lon, \
MIN(latitude) / 1e7 AS min_lat, MIN(longitude) / 1e7 AS min_lon from nodes"
)

result = await self.session.execute(sql_query)
retVal = result.mappings().first()
Expand Down
Loading