diff --git a/api/src/osm/repository.py b/api/src/osm/repository.py index 5d73a80..5ca1c9a 100644 --- a/api/src/osm/repository.py +++ b/api/src/osm/repository.py @@ -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()