mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-23 14:06:23 +02:00
Fix arguments.
This commit is contained in:
parent
b715e12924
commit
e3cf575f0d
5 changed files with 37 additions and 25 deletions
|
@ -221,7 +221,7 @@ def ui(arguments: argparse.Namespace) -> None:
|
||||||
else:
|
else:
|
||||||
if arguments.boundary_box:
|
if arguments.boundary_box:
|
||||||
boundary_box = BoundaryBox.from_text(arguments.boundary_box)
|
boundary_box = BoundaryBox.from_text(arguments.boundary_box)
|
||||||
else:
|
elif arguments.coordinates and arguments.size:
|
||||||
coordinates: np.ndarray = np.array(
|
coordinates: np.ndarray = np.array(
|
||||||
list(map(float, arguments.coordinates.split(",")))
|
list(map(float, arguments.coordinates.split(",")))
|
||||||
)
|
)
|
||||||
|
@ -231,6 +231,12 @@ def ui(arguments: argparse.Namespace) -> None:
|
||||||
boundary_box = BoundaryBox.from_coordinates(
|
boundary_box = BoundaryBox.from_coordinates(
|
||||||
coordinates, configuration.zoom_level, width, height
|
coordinates, configuration.zoom_level, width, height
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
logging.fatal(
|
||||||
|
"Specify either --input, or --boundary-box, or --coordinates "
|
||||||
|
"and --size."
|
||||||
|
)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cache_file_path: Path = (
|
cache_file_path: Path = (
|
||||||
|
|
|
@ -1429,6 +1429,7 @@ roads:
|
||||||
default_width: 15
|
default_width: 15
|
||||||
border_color: motorway_border_color
|
border_color: motorway_border_color
|
||||||
color: motorway_color
|
color: motorway_color
|
||||||
|
priority: 41.8
|
||||||
- tags: {highway: trunk}
|
- tags: {highway: trunk}
|
||||||
default_width: 13
|
default_width: 13
|
||||||
border_color: road_border_color
|
border_color: road_border_color
|
||||||
|
@ -1437,31 +1438,31 @@ roads:
|
||||||
default_width: 11
|
default_width: 11
|
||||||
border_color: primary_border_color
|
border_color: primary_border_color
|
||||||
color: primary_color
|
color: primary_color
|
||||||
priority: 41.9
|
priority: 41.7
|
||||||
- tags: {highway: motorway_link}
|
- tags: {highway: motorway_link}
|
||||||
default_width: 9
|
default_width: 9
|
||||||
border_color: motorway_border_color
|
border_color: motorway_border_color
|
||||||
color: motorway_color
|
color: motorway_color
|
||||||
priority: 41
|
priority: 41.8
|
||||||
- tags: {highway: secondary}
|
- tags: {highway: secondary}
|
||||||
default_width: 9
|
default_width: 9
|
||||||
border_color: secondary_border_color
|
border_color: secondary_border_color
|
||||||
priority: 41.8
|
priority: 41.6
|
||||||
color: secondary_color
|
color: secondary_color
|
||||||
- tags: {highway: secondary_link}
|
- tags: {highway: secondary_link}
|
||||||
default_width: 9
|
default_width: 9
|
||||||
border_color: secondary_border_color
|
border_color: secondary_border_color
|
||||||
priority: 41.8
|
priority: 41.6
|
||||||
color: secondary_color
|
color: secondary_color
|
||||||
- tags: {highway: tertiary}
|
- tags: {highway: tertiary}
|
||||||
default_width: 7
|
default_width: 7
|
||||||
border_color: tertiary_border_color
|
border_color: tertiary_border_color
|
||||||
priority: 41.7
|
priority: 41.5
|
||||||
color: tertiary_color
|
color: tertiary_color
|
||||||
- tags: {highway: tertiary_link}
|
- tags: {highway: tertiary_link}
|
||||||
default_width: 7
|
default_width: 7
|
||||||
border_color: tertiary_border_color
|
border_color: tertiary_border_color
|
||||||
priority: 41.7
|
priority: 41.5
|
||||||
color: tertiary_color
|
color: tertiary_color
|
||||||
- tags: {highway: unclassified}
|
- tags: {highway: unclassified}
|
||||||
default_width: 5
|
default_width: 5
|
||||||
|
|
|
@ -22,7 +22,7 @@ from map_machine.icon import ShapeExtractor
|
||||||
from map_machine.map_configuration import MapConfiguration
|
from map_machine.map_configuration import MapConfiguration
|
||||||
from map_machine.mapper import Map
|
from map_machine.mapper import Map
|
||||||
from map_machine.osm_getter import NetworkError, get_osm
|
from map_machine.osm_getter import NetworkError, get_osm
|
||||||
from map_machine.osm_reader import OSMData, OSMReader
|
from map_machine.osm_reader import OSMData
|
||||||
from map_machine.scheme import Scheme
|
from map_machine.scheme import Scheme
|
||||||
from map_machine.workspace import workspace
|
from map_machine.workspace import workspace
|
||||||
|
|
||||||
|
@ -104,7 +104,10 @@ class Tile:
|
||||||
)
|
)
|
||||||
get_osm(self.get_extended_boundary_box(), cache_file_path)
|
get_osm(self.get_extended_boundary_box(), cache_file_path)
|
||||||
|
|
||||||
return OSMReader().parse_osm_file(cache_file_path)
|
osm_data: OSMData = OSMData()
|
||||||
|
osm_data.parse_osm_file(cache_file_path)
|
||||||
|
|
||||||
|
return osm_data
|
||||||
|
|
||||||
def get_file_name(self, directory_name: Path) -> Path:
|
def get_file_name(self, directory_name: Path) -> Path:
|
||||||
"""Get tile output SVG file path."""
|
"""Get tile output SVG file path."""
|
||||||
|
@ -258,7 +261,10 @@ class Tiles:
|
||||||
)
|
)
|
||||||
get_osm(self.boundary_box, cache_file_path)
|
get_osm(self.boundary_box, cache_file_path)
|
||||||
|
|
||||||
return OSMReader().parse_osm_file(cache_file_path)
|
osm_data: OSMData = OSMData()
|
||||||
|
osm_data.parse_osm_file(cache_file_path)
|
||||||
|
|
||||||
|
return osm_data
|
||||||
|
|
||||||
def draw_separately(
|
def draw_separately(
|
||||||
self, directory: Path, cache_path: Path, configuration: MapConfiguration
|
self, directory: Path, cache_path: Path, configuration: MapConfiguration
|
||||||
|
@ -461,9 +467,8 @@ def ui(options: argparse.Namespace) -> None:
|
||||||
min_zoom_level: int = min(zoom_levels)
|
min_zoom_level: int = min(zoom_levels)
|
||||||
|
|
||||||
if options.input_file_name:
|
if options.input_file_name:
|
||||||
osm_reader: OSMReader = OSMReader()
|
osm_data: OSMData = OSMData()
|
||||||
osm_reader.parse_osm_file(Path(options.input_file_name))
|
osm_data.parse_osm_file(Path(options.input_file_name))
|
||||||
osm_data: OSMData = osm_reader.osm_data
|
|
||||||
for zoom_level in zoom_levels:
|
for zoom_level in zoom_levels:
|
||||||
configuration: MapConfiguration = MapConfiguration.from_options(
|
configuration: MapConfiguration = MapConfiguration.from_options(
|
||||||
options, zoom_level
|
options, zoom_level
|
||||||
|
|
|
@ -33,7 +33,8 @@ def test_wrong_render_arguments() -> None:
|
||||||
"""Test `render` command with wrong arguments."""
|
"""Test `render` command with wrong arguments."""
|
||||||
error_run(
|
error_run(
|
||||||
["render", "-z", "17"],
|
["render", "-z", "17"],
|
||||||
b"CRITICAL Specify either --boundary-box, or --input.\n",
|
b"CRITICAL Specify either --input, or --boundary-box, or --coordinates "
|
||||||
|
b"and --size.\n",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import numpy as np
|
||||||
from map_machine.osm_reader import (
|
from map_machine.osm_reader import (
|
||||||
OSMData,
|
OSMData,
|
||||||
OSMNode,
|
OSMNode,
|
||||||
OSMReader,
|
|
||||||
OSMRelation,
|
OSMRelation,
|
||||||
OSMWay,
|
OSMWay,
|
||||||
parse_levels,
|
parse_levels,
|
||||||
|
@ -18,8 +17,8 @@ __email__ = "me@enzet.ru"
|
||||||
|
|
||||||
def test_node() -> None:
|
def test_node() -> None:
|
||||||
"""Test OSM node parsing from XML."""
|
"""Test OSM node parsing from XML."""
|
||||||
reader: OSMReader = OSMReader()
|
osm_data: OSMData = OSMData()
|
||||||
osm_data: OSMData = reader.parse_osm_text(
|
osm_data.parse_osm_text(
|
||||||
"""<?xml version="1.0"?>
|
"""<?xml version="1.0"?>
|
||||||
<osm>
|
<osm>
|
||||||
<node id="42" lon="5" lat="10" />
|
<node id="42" lon="5" lat="10" />
|
||||||
|
@ -33,8 +32,8 @@ def test_node() -> None:
|
||||||
|
|
||||||
def test_node_with_tag() -> None:
|
def test_node_with_tag() -> None:
|
||||||
"""Test OSM node parsing from XML."""
|
"""Test OSM node parsing from XML."""
|
||||||
reader = OSMReader()
|
osm_data: OSMData = OSMData()
|
||||||
osm_data: OSMData = reader.parse_osm_text(
|
osm_data.parse_osm_text(
|
||||||
"""<?xml version="1.0"?>
|
"""<?xml version="1.0"?>
|
||||||
<osm>
|
<osm>
|
||||||
<node id="42" lon="5" lat="10">
|
<node id="42" lon="5" lat="10">
|
||||||
|
@ -51,8 +50,8 @@ def test_node_with_tag() -> None:
|
||||||
|
|
||||||
def test_way() -> None:
|
def test_way() -> None:
|
||||||
"""Test OSM way parsing from XML."""
|
"""Test OSM way parsing from XML."""
|
||||||
reader: OSMReader = OSMReader()
|
osm_data: OSMData = OSMData()
|
||||||
osm_data: OSMData = reader.parse_osm_text(
|
osm_data.parse_osm_text(
|
||||||
"""<?xml version="1.0"?>
|
"""<?xml version="1.0"?>
|
||||||
<osm>
|
<osm>
|
||||||
<way id="42" />
|
<way id="42" />
|
||||||
|
@ -65,8 +64,8 @@ def test_way() -> None:
|
||||||
|
|
||||||
def test_nodes() -> None:
|
def test_nodes() -> None:
|
||||||
"""Test OSM node parsing from XML."""
|
"""Test OSM node parsing from XML."""
|
||||||
reader = OSMReader()
|
osm_data: OSMData = OSMData()
|
||||||
osm_data: OSMData = reader.parse_osm_text(
|
osm_data.parse_osm_text(
|
||||||
"""<?xml version="1.0"?>
|
"""<?xml version="1.0"?>
|
||||||
<osm>
|
<osm>
|
||||||
<node id="1" lon="5" lat="10" />
|
<node id="1" lon="5" lat="10" />
|
||||||
|
@ -84,8 +83,8 @@ def test_nodes() -> None:
|
||||||
|
|
||||||
def test_relation() -> None:
|
def test_relation() -> None:
|
||||||
"""Test OSM node parsing from XML."""
|
"""Test OSM node parsing from XML."""
|
||||||
reader: OSMReader = OSMReader()
|
osm_data: OSMData = OSMData()
|
||||||
osm_data: OSMData = reader.parse_osm_text(
|
osm_data.parse_osm_text(
|
||||||
"""<?xml version="1.0"?>
|
"""<?xml version="1.0"?>
|
||||||
<osm>
|
<osm>
|
||||||
<node id="1" lon="5" lat="10" />
|
<node id="1" lon="5" lat="10" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue