Repository navigation
Add 'mvt rezoom' subcommand for overzooming and underzooming tiles - #47
Merged
Merged
Conversation
Add the ability to rezoom (overzoom or underzoom) source tiles into a single output tile at a target zoom level. Each source tile must be an ancestor or descendant of the target; features are re-projected and clipped to the target tile's bounding box at encode time. Library API (Sources/MVTTools/Overzoom.swift): - VectorTile.rezoom(toTargetX:targetY:targetZ:) — rezoom a single tile - VectorTile.rezoom(_:toTargetX:targetY:targetZ:) — rezoom multiple sources into one target tile - Ancestry validation uses MapTile.isRelated(to:) from gis-tools 2.0.7 CLI subcommand (Sources/MVTCLI/Rezoom.swift): - mvt rezoom [--target-x/y/z | inferred from --output path] [--output <file>] [--output-format <fmt>] [--buffer-*] [--simplify-*] [--layer <name>...] [--drop-layer <name>...] [--force-overwrite] [--strict] [--verbose] <source-tiles...> - --strict aborts on non-ancestor sources; without it, they are skipped - Target coordinates inferred from output path (e.g. 3_2_2.mvt) Refactoring: - Extract shared CLI.writeTile helper to Sources/MVTCLI/WriteTile.swift, removing duplication between MergeOptions and Rezoom - Update gis-tools dependency to 2.0.7 for MapTile.isRelated(to:) Tests: - 19 library tests (OverzoomTests): overzoom by 1 and 2, underzoom by 1, underzoom with multiple children, non-ancestry, same-zoom identity, all 4 projections, MVT round-trip with real test data, GeoJSON round-trip, mixed sources, skip-invalid - 7 CLI tests (RezoomCommandTests): overzoom, underzoom, --strict fails, non-strict skips, target inference from output path, missing target error, verbose output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
mvt rezoomCLI subcommand and library API for rezooming (overzooming or underzooming) source tiles into a single output tile at a target zoom level.Closes #46.
Usage
Examples
How it works
Each source tile must be an ancestor or descendant of the target tile (validated via
MapTile.isRelated(to:)from gis-tools 2.0.7). Features are copied in geographic coordinates; clipping to the target tile's bounding box (+ optional buffer) happens at encode time via the existingMVTEncoder/MLTEncoderprojection and clipping pipeline — no manual coordinate scaling needed.Library API
CLI behavior
--target-x/y/zor inferred from the--outputfile path (e.g.15_17432_16030.mvtor15/17432/16030.mvt).--strict: aborts with an error if any source is not an ancestor/descendant of the target. Without--strict, invalid sources are silently skipped.TileFormatloader and sharedCLI.writeTilehelper.Refactoring
Extracted the duplicated
writeTilemethod fromMergeOptionsinto a sharedCLI.writeTileinSources/MVTCLI/WriteTile.swift, used by bothMerge/Import/ExportandRezoom.Files changed
Sources/MVTTools/Overzoom.swift(new) —VectorTile.rezoom()instance + static methodsSources/MVTCLI/Rezoom.swift(new) —CLI.RezoomsubcommandSources/MVTCLI/WriteTile.swift(new) — sharedCLI.writeTilehelperSources/MVTCLI/CLI.swift— registerRezoom.selfSources/MVTCLI/MergeOptions.swift— use sharedCLI.writeTilePackage.swift— update gis-tools to 2.0.7Tests/MVTToolsTests/OverzoomTests.swift(new) — 19 library testsTests/MVTCLITests/RezoomCommandTests.swift(new) — 7 CLI testsTest plan
swift build— clean, no warningsswift test --filter OverzoomTests— 19/19 passswift test --filter RezoomCommandTests— 7/7 passswift test— 224/224 pass across 32 suitesswift run mvt rezoom --help— verified