Skip to content

Commit

Permalink
Bugfix webmercator X check (#44)
Browse files Browse the repository at this point in the history
* extent 1 and 2 can be equal

* test equal x
  • Loading branch information
rafaqz authored Dec 31, 2024
1 parent 27c4484 commit b074da0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function TileGrid(bbox::Extent, zoom::Int, crs::WGS84)
# Mercantile splits the bbox in two along the antimeridian if this happens.
# Decide if that case should be handled here or before, also considering
# antimeridian discussion in https://github.com/rafaqz/Extents.jl/issues/4
@assert bbox.X[1] < bbox.X[2]
@assert bbox.X[1] <= bbox.X[2]

# Clamp bounding values.
max_bbox = Extent(X = (-180.0, 180.0), Y = (-85.051129, 85.051129))
Expand Down
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ end
# creating a TileGrid from a web mercator extent
webbox = MT.project_extent(bbox, MT.wgs84, MT.web_mercator)
@test tilegrid === TileGrid(webbox, 8, MT.web_mercator)

@testset "equal X works" begin
bbox = Extent(X = (-1.23, -1.23), Y = (-5.68, 4.77))
@test_nowarn tilegrid = TileGrid(bbox, 8, MT.web_mercator)
end
end

@testset "project" begin
Expand Down

0 comments on commit b074da0

Please sign in to comment.