mirror of
https://github.com/enzet/map-machine.git
synced 2025-07-19 17:37:58 +02:00
Add Inskcape requirement.
This commit is contained in:
parent
bc08d90587
commit
a1f90abcbd
2 changed files with 12 additions and 11 deletions
|
@ -10,16 +10,22 @@ from typing import List
|
|||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
||||
INKSCAPE_BIN: str = "INKSCAPE_BIN"
|
||||
|
||||
|
||||
def rasterize(from_: Path, to_: Path, area: str = "", dpi: float = 90) -> None:
|
||||
"""
|
||||
Make PNG image out of SVG using Inkscape.
|
||||
"""
|
||||
inkscape: str = "inkscape"
|
||||
if "INKSCAPE_BIN" in os.environ:
|
||||
inkscape: str = os.environ["INKSCAPE_BIN"]
|
||||
|
||||
commands: List[str] = [inkscape]
|
||||
See https://inkscape.org/
|
||||
"""
|
||||
if "INKSCAPE_BIN" not in os.environ:
|
||||
logging.fatal(
|
||||
f"Environment variable {INKSCAPE_BIN} not set. Please, install "
|
||||
f"Inkscape and set the variable to be able to rasterize SVG files."
|
||||
)
|
||||
|
||||
commands: List[str] = [os.environ[INKSCAPE_BIN]]
|
||||
commands += ["--export-png", to_.absolute()]
|
||||
commands += ["--export-dpi", str(dpi)]
|
||||
if area:
|
||||
|
|
|
@ -83,12 +83,7 @@ class RoadPart:
|
|||
|
||||
@classmethod
|
||||
def from_nodes(
|
||||
cls,
|
||||
node_1: OSMNode,
|
||||
node_2: OSMNode,
|
||||
flinger: Flinger,
|
||||
road,
|
||||
scale,
|
||||
cls, node_1: OSMNode, node_2: OSMNode, flinger: Flinger, road, scale
|
||||
) -> "RoadPart":
|
||||
"""
|
||||
Construct road part from OSM nodes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue