Fix zoom level.

Zoom level may be float and should not be cast to integer.
This commit is contained in:
Sergey Vartanov 2021-09-22 08:32:57 +03:00
parent 23a05534df
commit e2ab792213
3 changed files with 5 additions and 5 deletions

View file

@ -58,7 +58,7 @@ class MapConfiguration:
@classmethod @classmethod
def from_options( def from_options(
cls, options: argparse.Namespace, zoom_level: int cls, options: argparse.Namespace, zoom_level: float
) -> "MapConfiguration": ) -> "MapConfiguration":
"""Initialize from command-line options.""" """Initialize from command-line options."""
return cls( return cls(

View file

@ -191,7 +191,7 @@ def ui(arguments: argparse.Namespace) -> None:
:param arguments: command-line arguments :param arguments: command-line arguments
""" """
configuration: MapConfiguration = MapConfiguration.from_options( configuration: MapConfiguration = MapConfiguration.from_options(
arguments, int(arguments.zoom) arguments, float(arguments.zoom)
) )
cache_path: Path = Path(arguments.cache) cache_path: Path = Path(arguments.cache)
cache_path.mkdir(parents=True, exist_ok=True) cache_path.mkdir(parents=True, exist_ok=True)

View file

@ -159,7 +159,7 @@ def add_tile_arguments(parser: argparse.ArgumentParser) -> None:
"-z", "-z",
"--zoom", "--zoom",
type=str, type=str,
metavar="<integer>", metavar="<range>",
help="OSM zoom levels; can be list of numbers or ranges, e.g. `16-18`, " help="OSM zoom levels; can be list of numbers or ranges, e.g. `16-18`, "
"`16,17,18`, or `16,18-20`", "`16,17,18`, or `16,18-20`",
default="18", default="18",
@ -233,8 +233,8 @@ def add_render_arguments(parser: argparse.ArgumentParser) -> None:
parser.add_argument( parser.add_argument(
"-z", "-z",
"--zoom", "--zoom",
type=int, type=float,
metavar="<integer>", metavar="<float>",
help="OSM zoom level", help="OSM zoom level",
default=18, default=18,
) )