#!/usr/bin/env python3 """ generate_pdf_metadata.py ======================== Generates a human-readable PDF metadata report for MatchGeo-DEM. Requires: fpdf2 Install: pip install fpdf2 Usage: python generate_pdf_metadata.py --output MatchGeo-DEM_Metadata_Report.pdf """ import argparse from pathlib import Path from datetime import datetime try: from fpdf import FPDF HAS_FPDF = True except ImportError: HAS_FPDF = False raise ImportError("fpdf2 is required. Install: pip install fpdf2") CITIES = [ {"id": "ATA_MV", "name": "Mount Athos, Greece", "epsg": 3031, "resolution": 2.0, "method": "Satellite InSAR", "n_tiles": 5625, "labelled": False, "year": "2011–2015", "provider": "Copernicus DEM (ESA)"}, {"id": "BRA_SP", "name": "São Paulo, Brazil", "epsg": 31983, "resolution": 0.5, "method": "Airborne LiDAR", "n_tiles": 558, "labelled": True, "year": "2020", "provider": "GeoSampa (PMSP)"}, {"id": "CHN_WS", "name": "Wutai Shan, China", "epsg": 32649, "resolution": 1.0, "method": "UAV SfM", "n_tiles": 1076, "labelled": False, "year": "2021", "provider": "OpenTopography (Zhou, C.)"}, {"id": "ESP_EH", "name": "El Hierro, Spain", "epsg": 3040, "resolution": 1.0, "method": "Airborne LiDAR", "n_tiles": 2460, "labelled": False, "year": "2022–2025", "provider": "PNOA-LiDAR (CNIG)"}, {"id": "FIN_LM", "name": "Lahti, Finland", "epsg": 3067, "resolution": 2.0, "method": "LiDAR + Photogrammetry", "n_tiles": 248, "labelled": False, "year": "2020–2026", "provider": "National Land Survey of Finland"}, {"id": "GER_BN", "name": "Bonn, Germany", "epsg": 25832, "resolution": 1.0, "method": "Airborne LiDAR", "n_tiles": 1759, "labelled": True, "year": "2016–2018", "provider": "Geobasis NRW"}, {"id": "IDN_SV", "name": "Sinabung Volcano, Indonesia", "epsg": 32647, "resolution": 0.87, "method": "UAS SfM", "n_tiles": 181, "labelled": False, "year": "2018", "provider": "OpenTopography (Carr, B.)"}, {"id": "KAZ_AC", "name": "Almaty City, Kazakhstan", "epsg": 32643, "resolution": 1.0, "method": "Pleiades Tristereo", "n_tiles": 887, "labelled": False, "year": "2017", "provider": "OpenTopography (Amey et al.)"}, {"id": "KSA_WA", "name": "Wadi Al-Akhdar, Saudi Arabia", "epsg": 32637, "resolution": 1.6, "method": "SPOT 6 Stereo", "n_tiles": 3880, "labelled": False, "year": "2016", "provider": "OpenTopography (Matthieu et al.)"}, {"id": "NAM_HF", "name": "Hebron Fault, Namibia", "epsg": 32733, "resolution": 0.53, "method": "WorldView-3 Stereo", "n_tiles": 1457, "labelled": False, "year": "2017", "provider": "OpenTopography (Salomon et al.)"}, {"id": "NZL_KP", "name": "Kapiti Coast, New Zealand", "epsg": 2193, "resolution": 1.0, "method": "Airborne LiDAR", "n_tiles": 1776, "labelled": False, "year": "2010–2025", "provider": "LINZ"}, {"id": "PHL_TA", "name": "Tarlac, Philippines", "epsg": 32651, "resolution": 1.0, "method": "Airborne LiDAR", "n_tiles": 286, "labelled": False, "year": "2014–2017", "provider": "LiPAD (UP Diliman)"}, {"id": "USA_GC", "name": "Grand Canyon, United States", "epsg": 6341, "resolution": 10.0, "method": "LiDAR + IfSAR", "n_tiles": 600, "labelled": False, "year": "2020–2026", "provider": "USGS 3DEP"}, ] class PDF(FPDF): def header(self): if self.page_no() == 1: return self.set_font("Helvetica", "B", 10) self.set_text_color(40, 40, 40) self.cell(0, 8, "MatchGeo-DEM Dataset Metadata Report", border=0, align="L") self.cell(0, 8, f"Page {self.page_no()}", border=0, align="R") self.ln(10) self.set_draw_color(180, 180, 180) self.line(10, self.get_y(), 200, self.get_y()) self.ln(5) def footer(self): self.set_y(-15) self.set_font("Helvetica", "I", 8) self.set_text_color(128, 128, 128) self.cell(0, 10, f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M')} | DOI: 10.5281/zenodo.19339008", align="C") def chapter_title(self, title, level=1): if level == 1: self.set_font("Helvetica", "B", 16) self.set_text_color(0, 51, 102) self.ln(8) self.cell(0, 10, title, ln=True) self.set_draw_color(0, 51, 102) self.line(10, self.get_y(), 200, self.get_y()) self.ln(6) else: self.set_font("Helvetica", "B", 12) self.set_text_color(0, 51, 102) self.ln(6) self.cell(0, 8, title, ln=True) self.ln(2) def body_text(self, text, bold=False): self.set_font("Helvetica", "B" if bold else "", 10) self.set_text_color(40, 40, 40) self.multi_cell(0, 5, text) self.ln(2) def info_row(self, label, value): self.set_font("Helvetica", "B", 10) self.set_text_color(60, 60, 60) self.cell(50, 6, label + ":", align="L") self.set_font("Helvetica", "", 10) self.set_text_color(40, 40, 40) self.cell(0, 6, str(value), align="L") self.ln() def generate_pdf(output_path): pdf = PDF() pdf.set_auto_page_break(auto=True, margin=15) pdf.add_page() # ===== COVER PAGE ===== pdf.set_font("Helvetica", "B", 24) pdf.set_text_color(0, 51, 102) pdf.ln(40) pdf.cell(0, 15, "MatchGeo-DEM", ln=True, align="C") pdf.set_font("Helvetica", "", 14) pdf.cell(0, 10, "Multi-City Digital Elevation Model Dataset", ln=True, align="C") pdf.cell(0, 10, "for Local Feature Matching", ln=True, align="C") pdf.ln(20) pdf.set_font("Helvetica", "", 11) pdf.set_text_color(80, 80, 80) pdf.multi_cell(0, 6, "This report provides a human-readable summary of the MatchGeo-DEM dataset " "(Version 1.1), including its structure, provenance, licensing, and per-city coverage. " "It is intended for data managers, reviewers, and users who need a quick reference " "without opening machine-readable metadata files.", align="C" ) pdf.ln(30) pdf.set_font("Helvetica", "B", 11) pdf.set_text_color(40, 40, 40) pdf.cell(0, 8, "Dataset DOI: 10.5281/zenodo.19339008", ln=True, align="C") pdf.cell(0, 8, "License: CC BY 4.0", ln=True, align="C") pdf.cell(0, 8, f"Report Date: {datetime.now().strftime('%Y-%m-%d')}", ln=True, align="C") pdf.cell(0, 8, "Contact: sabrina.correa@ufv.br", ln=True, align="C") # ===== OVERVIEW ===== pdf.add_page() pdf.chapter_title("1. Dataset Overview") pdf.body_text( "MatchGeo is a curated, multi-city Digital Elevation Model (DEM) dataset designed for " "training and benchmarking local feature matching algorithms in urban and natural terrain analysis. " "It aggregates high-resolution elevation data from 13 distinct environments across 6 continents, " "supporting cross-domain generalization studies under varying acquisition methods, climates, and terrain types." ) pdf.info_row("Title", "MatchGeo: Multi-City DEM Dataset for Local Feature Matching") pdf.info_row("Version", "1.1") pdf.info_row("Release Date", "2026-05-11") pdf.info_row("Total Cities", "13") pdf.info_row("Total Tiles", "20,793") pdf.info_row("Labelled Tiles", "213 (Bonn, Germany)") pdf.info_row("Total Annotations", "27,000+ (handcrafted keypoints)") pdf.info_row("Tile Size", "333 × 333 pixels") pdf.info_row("Pixel Depth", "Float32") pdf.info_row("NoData Value", "-9999") pdf.info_row("Compression", "DEFLATE") pdf.info_row("Format", "GeoTIFF (BigTIFF, tiled, OGC 23-008r3 compliant)") pdf.ln(5) pdf.chapter_title("2. Authors & Contact", level=2) pdf.info_row("Authors", "Correa, S. P. L. P.; Santos, A. de Paula; Oliveira, H. N.; Beltons, D.") pdf.info_row("Institution", "Universidade Federal de Viçosa (UFV)") pdf.info_row("Contact", "sabrina.correa@ufv.br") pdf.info_row("Repository", "https://doi.org/10.5281/zenodo.19339008") pdf.ln(5) # ===== LICENSE ===== pdf.chapter_title("3. License & Attribution", level=2) pdf.body_text( "This dataset is released under the Creative Commons Attribution 4.0 International License (CC BY 4.0). " "You are free to share and adapt the material for any purpose, even commercially, provided you give " "appropriate credit, provide a link to the license, and indicate if changes were made." ) pdf.body_text( "When using this dataset, you must cite the dataset DOI and acknowledge the original data providers " "for each city used in your study. Full attribution statements are provided in the DATASET_DESCRIPTION.md file." ) pdf.ln(5) # ===== TECHNICAL SPECIFICATIONS ===== pdf.chapter_title("4. Technical Specifications", level=2) pdf.info_row("Raster Format", "GeoTIFF (BigTIFF variant)") pdf.info_row("Internal Tiling", "256 × 256 pixels") pdf.info_row("Patch Dimensions", "333 × 333 pixels") pdf.info_row("Data Type", "Float32") pdf.info_row("Coordinate Systems", "City-specific UTM / local CRS (EPSG)") pdf.info_row("Metadata Standard", "ISO 19115-2 + OGC 23-008r3") pdf.info_row("Machine Catalog", "JSON-LD manifest.json + STAC 1.0.0 collection") pdf.ln(5) # ===== PROCESSING PIPELINE ===== pdf.chapter_title("5. Processing Pipeline", level=2) pdf.body_text( "All cities were processed through a standardized PDAL 2.6.0 pipeline with city-specific adaptations:" ) steps = [ "1. Acquisition — Raw data retrieved from source portals in native CRS and resolution.", "2. Preprocessing — City-specific filtering (ground classification, outlier removal, noise filtering).", "3. Rasterization — PDAL writers.gdal with output_type=max (DSM), float32, nodata=-9999.", "4. Standardization — BigTIFF, TILED=YES, COMPRESS=DEFLATE.", "5. Patch Extraction — Non-overlapping 333×333 pixel grid (no resampling).", "6. Annotation — Handcrafted keypoints in normalized coordinates (Bonn, São Paulo).", "7. Metadata — Per-city ISO 19115-2 JSON; central JSON-LD manifest.", ] for step in steps: pdf.body_text(step) pdf.ln(5) # ===== PER-CITY TABLE ===== pdf.add_page() pdf.chapter_title("6. Per-City Coverage") pdf.body_text( "The following table summarizes each city's geographic coverage, acquisition method, resolution, " "and annotation status. All tiles are 333×333 pixel GeoTIFF patches." ) pdf.ln(3) # Table header pdf.set_fill_color(0, 51, 102) pdf.set_text_color(255, 255, 255) pdf.set_font("Helvetica", "B", 9) pdf.cell(22, 7, "City", fill=True) pdf.cell(45, 7, "Location", fill=True) pdf.cell(30, 7, "Method", fill=True) pdf.cell(18, 7, "Res (m)", fill=True) pdf.cell(18, 7, "Tiles", fill=True) pdf.cell(20, 7, "Labelled", fill=True) pdf.cell(25, 7, "Year", fill=True) pdf.ln() # Table rows pdf.set_text_color(40, 40, 40) pdf.set_font("Helvetica", "", 8) fill = False for city in CITIES: if pdf.get_y() > 260: pdf.add_page() pdf.set_fill_color(0, 51, 102) pdf.set_text_color(255, 255, 255) pdf.set_font("Helvetica", "B", 9) pdf.cell(22, 7, "City", fill=True) pdf.cell(45, 7, "Location", fill=True) pdf.cell(30, 7, "Method", fill=True) pdf.cell(18, 7, "Res (m)", fill=True) pdf.cell(18, 7, "Tiles", fill=True) pdf.cell(20, 7, "Labelled", fill=True) pdf.cell(25, 7, "Year", fill=True) pdf.ln() pdf.set_text_color(40, 40, 40) pdf.set_font("Helvetica", "", 8) fill = False pdf.set_fill_color(240, 240, 240) if fill else pdf.set_fill_color(255, 255, 255) pdf.cell(22, 6, city["id"], fill=True) pdf.cell(45, 6, city["name"], fill=True) pdf.cell(30, 6, city["method"], fill=True) pdf.cell(18, 6, str(city["resolution"]), fill=True) pdf.cell(18, 6, str(city["n_tiles"]), fill=True) pdf.cell(20, 6, "Yes" if city["labelled"] else "No", fill=True) pdf.cell(25, 6, city["year"], fill=True) pdf.ln() fill = not fill pdf.ln(5) pdf.set_font("Helvetica", "I", 8) pdf.set_text_color(100, 100, 100) pdf.multi_cell(0, 4, "Note: BRA_SP is marked as labelled in the dataset schema but currently has zero annotation files " "(annotations pending). GER_BN contains 27,000+ handcrafted keypoint annotations.") # ===== DATA SPLITS ===== pdf.add_page() pdf.chapter_title("7. Data Splits") pdf.body_text( "The dataset is partitioned into train / validation / test splits stratified by city and difficulty. " "Split manifests are provided as CSV files in the splits/ directory." ) pdf.info_row("Train", "80%") pdf.info_row("Validation", "10%") pdf.info_row("Test", "10%") pdf.info_row("Stratification", "By city and difficulty (flat, medium, steep, urban_density)") pdf.ln(5) # ===== KNOWN LIMITATIONS ===== pdf.chapter_title("8. Known Limitations", level=2) limitations = [ "• Geographic bias: Dense annotations are currently available only for GER_BN. BRA_SP annotations are pending.", "• Temporal mismatch: Data spans 2011–2026 across cities; users should account for temporal drift.", "• Sensor heterogeneity: LiDAR, photogrammetry, SfM, and satellite stereo have different noise characteristics.", "• Resolution heterogeneity: Native resolutions range from 0.5 m to 10 m; all tiles are 333×333 pixels.", "• Missing data: Water bodies and ocean areas are excluded (NoData = -9999).", ] for lim in limitations: pdf.body_text(lim) pdf.ln(5) # ===== CITATION ===== pdf.chapter_title("9. How to Cite", level=2) pdf.body_text("Dataset citation (BibTeX):", bold=True) pdf.set_font("Courier", "", 8) pdf.set_text_color(40, 40, 40) bibtex = """@dataset{correa_2026_matchgeo, author = {Correa, S. P. L. P. and Santos, A. de Paula and Oliveira, H. N. and Beltons, D.}, title = {MatchGeo: Multi-City Digital Elevation Model Dataset for Local Feature Matching}, year = 2026, publisher = {Zenodo}, version = {1.1}, doi = {10.5281/zenodo.19339008}, url = {https://doi.org/10.5281/zenodo.19339008} }""" pdf.multi_cell(0, 4, bibtex) pdf.ln(5) pdf.set_font("Helvetica", "", 10) pdf.body_text("Plain text citation:", bold=True) pdf.body_text( "Correa, S. P. L. P., Santos, A. de Paula, Oliveira, H. N., & Beltons, D. (2026). " "MatchGeo: Multi-City Digital Elevation Model Dataset for Local Feature Matching (Version 1.1) [Data set]. " "Zenodo. https://doi.org/10.5281/zenodo.19339008" ) # ===== BACK PAGE ===== pdf.add_page() pdf.set_font("Helvetica", "B", 14) pdf.set_text_color(0, 51, 102) pdf.ln(80) pdf.cell(0, 10, "End of Report", ln=True, align="C") pdf.set_font("Helvetica", "", 10) pdf.set_text_color(100, 100, 100) pdf.cell(0, 8, "For questions or bug reports, contact: sabrina.correa@ufv.br", ln=True, align="C") pdf.cell(0, 8, "Zenodo: https://doi.org/10.5281/zenodo.19339008", ln=True, align="C") pdf.cell(0, 8, "Hugging Face: https://huggingface.co/datasets/paeslemesa/matchgeo", ln=True, align="C") # Save pdf.output(output_path) print(f"✅ PDF report saved: {output_path}") def main(): parser = argparse.ArgumentParser(description="Generate MatchGeo-DEM PDF metadata report") parser.add_argument("--output", default="MatchGeo-DEM_Metadata_Report.pdf", help="Output PDF path") args = parser.parse_args() generate_pdf(args.output) if __name__ == "__main__": main()