mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-03 11:21:49 +02:00
Issue #23: fix building height and shade.
This commit is contained in:
parent
2fccc9cf67
commit
2ffac6f98b
3 changed files with 20 additions and 12 deletions
|
@ -3,6 +3,8 @@ Author: Sergey Vartanov (me@enzet.ru)
|
|||
|
||||
Geo projection.
|
||||
"""
|
||||
from typing import Optional
|
||||
|
||||
import numpy as np
|
||||
|
||||
from roentgen.util import MinMax
|
||||
|
@ -66,11 +68,15 @@ class Flinger:
|
|||
|
||||
return result
|
||||
|
||||
def get_scale(self, coordinates: np.array) -> float:
|
||||
def get_scale(self, coordinates: Optional[np.array] = None) -> float:
|
||||
"""
|
||||
Return pixels per meter ratio for the given geo coordinates.
|
||||
|
||||
:param coordinates: geo coordinates
|
||||
"""
|
||||
scale_factor = 1 / np.cos(coordinates[0] / 180 * np.pi)
|
||||
if coordinates is None:
|
||||
# Get pixels per meter ratio for the center of the boundary box.
|
||||
coordinates = self.geo_boundaries.center()
|
||||
|
||||
scale_factor: float = 1 / np.cos(coordinates[0] / 180 * np.pi)
|
||||
return self.pixels_per_meter * scale_factor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue