Skip to content

Commit 616e42b

Browse files
committed
Background InfoSequence hotfix.
1 parent 2b93da1 commit 616e42b

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

maps4fs/generator/component.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ def update_generation_info(self, data: dict[Any, Any]) -> None:
138138
def get_bbox(
139139
self,
140140
coordinates: tuple[float, float] | None = None,
141-
distance: int | None = None,
141+
height_distance: int | None = None,
142+
width_distance: int | None = None,
142143
project_utm: bool = False,
143144
) -> tuple[int, int, int, int]:
144145
"""Calculates the bounding box of the map from the coordinates and the height and
@@ -148,28 +149,34 @@ def get_bbox(
148149
Args:
149150
coordinates (tuple[float, float], optional): The latitude and longitude of the center of
150151
the map. Defaults to None.
151-
distance (int, optional): The distance from the center of the map to the edge of the
152-
map. Defaults to None.
152+
height_distance (int, optional): The distance from the center of the map to the edge of
153+
the map in the north-south direction. Defaults to None.
154+
width_distance (int, optional): The distance from the center of the map to the edge of
155+
the map in the east-west direction. Defaults to None.
153156
project_utm (bool, optional): Whether to project the bounding box to UTM.
154157
155158
Returns:
156159
tuple[int, int, int, int]: The bounding box of the map.
157160
"""
158161
coordinates = coordinates or self.coordinates
159-
distance = distance or int(self.map_height / 2)
162+
height_distance = height_distance or int(self.map_height / 2)
163+
width_distance = width_distance or int(self.map_width / 2)
160164

161165
north, south, _, _ = ox.utils_geo.bbox_from_point(
162-
coordinates, dist=distance, project_utm=project_utm
166+
coordinates, dist=height_distance, project_utm=project_utm
163167
)
164168
_, _, east, west = ox.utils_geo.bbox_from_point(
165-
coordinates, dist=distance, project_utm=project_utm
169+
coordinates, dist=width_distance, project_utm=project_utm
166170
)
167171
bbox = north, south, east, west
168172
self.logger.debug(
169-
"Calculated bounding box for component: %s: %s, project_utm: %s",
173+
"Calculated bounding box for component: %s: %s, project_utm: %s, "
174+
"height_distance: %s, width_distance: %s",
170175
self.__class__.__name__,
171176
bbox,
172177
project_utm,
178+
height_distance,
179+
width_distance,
173180
)
174181
return bbox
175182

maps4fs/generator/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def info_sequence(self) -> dict[str, dict[str, str | float | int]]:
6767
# if the map is 2048x2048 or 4096x4096, the overview will be 4096x4096
6868
# and the map will be in the center of the overview.
6969
# That's why the distance is set to the map height not as a half of it.
70-
bbox = self.get_bbox(distance=self.map_height)
70+
bbox = self.get_bbox(height_distance=self.map_height, width_distance=self.map_width)
7171
south, west, north, east = bbox
7272
epsg3857_string = self.get_epsg3857_string(bbox=bbox)
7373

0 commit comments

Comments
 (0)