From f0c62a4b444c18bbb16a6fcb2df2b0986f117da5 Mon Sep 17 00:00:00 2001 From: nq Date: Sun, 3 May 2026 02:56:09 -0700 Subject: [PATCH] working-stage-2 export to kml --- stage-2-parse-stage-1/landmarks_csv_to_osmand.py | 4 ++++ stage-2-parse-stage-1/readme.md | 13 ++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/stage-2-parse-stage-1/landmarks_csv_to_osmand.py b/stage-2-parse-stage-1/landmarks_csv_to_osmand.py index 4ade7f6..9f8c83f 100644 --- a/stage-2-parse-stage-1/landmarks_csv_to_osmand.py +++ b/stage-2-parse-stage-1/landmarks_csv_to_osmand.py @@ -183,6 +183,7 @@ def coord_distance_m(a: Landmark, b: Landmark) -> float: def load_landmarks(paths: Iterable[Path]) -> list[Landmark]: items: list[Landmark] = [] + print(f"Loading detected CSVs - {len(paths)} total CSVs") for path in paths: with open_text(path, "r") as f: reader = csv.DictReader(f) @@ -213,6 +214,7 @@ def load_landmarks(paths: Iterable[Path]) -> list[Landmark]: garmin_image_file=sanitize_text((row.get("garmin_image_file") or "").strip()), source_files=[path.name], )) + print("Done reading CSVs") return items def dedupe_signature(it: Landmark, mode: str) -> tuple: @@ -845,6 +847,7 @@ def apply_postprocess(props: dict[str, str], group: dict[str, Any], config: dict def build_records(items: list[Landmark], config: dict[str, Any]) -> tuple[list[dict[str, Any]], list[Landmark]]: out = [] unmatched: list[Landmark] = [] + print("Building records - ", len(items)) for it in items: group = assign_group(it, config) if group is None: @@ -885,6 +888,7 @@ def build_records(items: list[Landmark], config: dict[str, Any]) -> tuple[list[d "source_files": list(it.source_files), "duplicate_count": it.duplicate_count, }) + print("Finished constructing the records") return out, unmatched def write_unmatched_csv(items: list[Landmark], path: Path): diff --git a/stage-2-parse-stage-1/readme.md b/stage-2-parse-stage-1/readme.md index a76aac1..f72484b 100644 --- a/stage-2-parse-stage-1/readme.md +++ b/stage-2-parse-stage-1/readme.md @@ -120,22 +120,13 @@ Each KML/KMZ contains: Example build: ```bash -python landmarks_csv_to_osmand_google_earth.py build parsed-landmarks/csv/*.csv ^ - --config stage2_config.json ^ - --kml bgmountains_landmarks.kml ^ - --kmz bgmountains_landmarks.kmz ^ - --resolved-csv resolved.csv ^ - --summary-json build_summary.json +python landmarks_csv_to_osmand_google_earth.py build parsed-landmarks/csv/*.csv --config stage2_config.json --kml bgmountains_landmarks.kml --kmz bgmountains_landmarks.kmz --resolved-csv resolved.csv --summary-json build_summary.json ``` For large datasets, use this instead: ```bash -python landmarks_csv_to_osmand_google_earth.py build parsed-landmarks/csv/*.csv ^ - --config stage2_config.json ^ - --kmz-split-dir google-earth-groups ^ - --kml-folder-visibility 0 ^ - --kml-label-scale 0 +python landmarks_csv_to_osmand_google_earth.py build parsed-landmarks/csv/*.csv --config stage2_config.json --kmz-split-dir google-earth-groups --kml-folder-visibility 0 --kml-label-scale 0 ``` That creates one `.kmz` per group plus: