aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fietsboek/hittekaart.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/fietsboek/hittekaart.py b/fietsboek/hittekaart.py
index 3b0c103..005fcf2 100644
--- a/fietsboek/hittekaart.py
+++ b/fietsboek/hittekaart.py
@@ -17,17 +17,12 @@ from sqlalchemy import select
from sqlalchemy.orm import aliased
from sqlalchemy.orm.session import Session
-from . import models
+from . import geo, models
from .data import DataManager
from .models.track import TrackType
LOGGER = logging.getLogger(__name__)
-COMPRESSION_MAP = {
- ".br": "brotli",
- ".gz": "gzip",
-}
-
TILEHUNTER_ZOOM = 14
@@ -45,7 +40,7 @@ class Mode(enum.Enum):
def generate(
output: Path,
mode: Mode,
- input_files: list[Path],
+ input_files: list[geo.Path],
*,
threads: int = 0,
):
@@ -54,7 +49,7 @@ def generate(
:param output: Output filename. Note that this function always uses the
sqlite output mode.
:param mode: What to generate.
- :param input_files: List of paths to the input files.
+ :param input_files: List of input paths.
:param threads: Number of threads that ``hittekaart`` should use. Defaults
to 0, which uses all available cores.
"""
@@ -74,7 +69,9 @@ def generate(
LOGGER.debug("Loading tracks ...")
tracks = [
- hittekaart_py.Track.from_file(bytes(input_file), COMPRESSION_MAP.get(input_file.suffix))
+ hittekaart_py.Track.from_coordinates(
+ [(point.longitude, point.latitude) for point in input_file.points]
+ )
for input_file in input_files
]
LOGGER.debug("Tracks loaded!")
@@ -128,8 +125,7 @@ def generate_for(
for track in dbsession.execute(query).scalars():
if track.id is None:
continue
- path = data_manager.open(track.id).gpx_path()
- input_paths.append(path)
+ input_paths.append(track.path())
if not input_paths:
return