Skip to content

Commit

Permalink
Allow to merge tiles with different coordinates, for some weird use c…
Browse files Browse the repository at this point in the history
…ases
  • Loading branch information
trasch committed Jun 6, 2024
1 parent 728a793 commit 1c0fb6e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Sources/MVTTools/Merge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ extension VectorTile {

/// Merge another vector tile into this tile.
@discardableResult
public mutating func merge(_ other: VectorTile) -> Bool {
guard other.x == x,
other.y == y,
other.z == z
else {
(logger ?? VectorTile.logger)?.warning("\(z)/\(x)/\(y): Failed to merge, other has different coordinate \(other.z)/\(other.x)/\(other.y)")
return false
public mutating func merge(
_ other: VectorTile,
ignoreTileCoordinateMismatch: Bool = false)
-> Bool
{
if !ignoreTileCoordinateMismatch {
guard other.x == x,
other.y == y,
other.z == z
else {
(logger ?? VectorTile.logger)?.warning("\(z)/\(x)/\(y): Failed to merge, other has different coordinate \(other.z)/\(other.x)/\(other.y)")
return false
}
}

if other.projection != projection {
Expand Down

0 comments on commit 1c0fb6e

Please sign in to comment.