mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-06 12:51:53 +02:00
Fix boundary box computing.
This commit is contained in:
parent
cdbe567483
commit
c64eefec0b
2 changed files with 12 additions and 0 deletions
|
@ -285,6 +285,8 @@ def render_map(arguments: argparse.Namespace) -> None:
|
||||||
|
|
||||||
if not boundary_box:
|
if not boundary_box:
|
||||||
boundary_box = osm_data.view_box
|
boundary_box = osm_data.view_box
|
||||||
|
if not boundary_box:
|
||||||
|
boundary_box = osm_data.boundary_box
|
||||||
|
|
||||||
# Render
|
# Render
|
||||||
|
|
||||||
|
|
|
@ -329,6 +329,7 @@ class OSMData:
|
||||||
self.levels: set[float] = set()
|
self.levels: set[float] = set()
|
||||||
self.time: MinMax = MinMax()
|
self.time: MinMax = MinMax()
|
||||||
self.view_box: Optional[BoundaryBox] = None
|
self.view_box: Optional[BoundaryBox] = None
|
||||||
|
self.boundary_box: Optional[BoundaryBox] = None
|
||||||
self.equator_length: float = EARTH_EQUATOR_LENGTH
|
self.equator_length: float = EARTH_EQUATOR_LENGTH
|
||||||
|
|
||||||
def add_node(self, node: OSMNode) -> None:
|
def add_node(self, node: OSMNode) -> None:
|
||||||
|
@ -344,6 +345,15 @@ class OSMData:
|
||||||
self.levels.union(parse_levels(node.tags["level"]))
|
self.levels.union(parse_levels(node.tags["level"]))
|
||||||
self.time.update(node.timestamp)
|
self.time.update(node.timestamp)
|
||||||
|
|
||||||
|
if not self.boundary_box:
|
||||||
|
self.boundary_box = BoundaryBox(
|
||||||
|
node.coordinates[1],
|
||||||
|
node.coordinates[0],
|
||||||
|
node.coordinates[1],
|
||||||
|
node.coordinates[0],
|
||||||
|
)
|
||||||
|
self.boundary_box.update(node.coordinates)
|
||||||
|
|
||||||
def add_way(self, way: OSMWay) -> None:
|
def add_way(self, way: OSMWay) -> None:
|
||||||
"""Add way and update map parameters."""
|
"""Add way and update map parameters."""
|
||||||
if way.id_ in self.ways:
|
if way.id_ in self.ways:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue