Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ let package = Package(
targets: ["MVTTools"]),
],
dependencies: [
.package(url: "https://github.com/Outdooractive/gis-tools", from: "2.0.6"),
.package(url: "https://github.com/Outdooractive/gis-tools", from: "2.0.7"),
.package(url: "https://github.com/Outdooractive/gis-tools-geopackage", from: "1.0.1"),
.package(url: "https://github.com/Outdooractive/gis-tools-gpx", from: "1.0.4"),
.package(url: "https://github.com/Outdooractive/gis-tools-shapefile", from: "1.0.2"),
Expand Down
1 change: 1 addition & 0 deletions Sources/MVTCLI/CLI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct CLI: AsyncParsableCommand {
Import.self,
Export.self,
Load.self,
Rezoom.self,
],
defaultSubcommand: Dump.self)

Expand Down
40 changes: 2 additions & 38 deletions Sources/MVTCLI/MergeOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ extension CLI.MergeOptions {
}

if let outputUrl {
try await Self.writeTile(
try await CLI.writeTile(
tile,
format: resolvedOutputFormat,
to: outputUrl,
Expand All @@ -335,41 +335,5 @@ extension CLI.MergeOptions {
}
}

/// Write a tile to a file in the given format.
private static func writeTile(
_ tile: VectorTile,
format: TileFormat,
to url: URL,
options: VectorTile.ExportOptions,
prettyPrint: Bool,
propertyName: String?
) async throws {
switch format {
case .geoJson:
guard let data = tile.toGeoJson(
prettyPrinted: prettyPrint,
layerProperty: propertyName,
options: options)
else { throw CLIError("Failed to extract the tile data as GeoJSON") }
try data.write(to: url, options: .atomic)

case .mvt:
tile.writeMVT(to: url, options: options)

case .mlt:
tile.writeMLT(to: url, options: options)

case .gpx:
guard tile.writeGPX(to: url, options: options) else {
throw CLIError("Failed to write GPX")
}

case .shapefile:
try tile.writeShapefile(to: url, options: options)

case .geopackage:
try await tile.writeGeoPackage(to: url, options: options)
}
}

}

Loading
Loading