Skip to content

Commit 9b19b09

Browse files
authored
Fix the tiles y counting that was bugging Nimbo coordinates. (#1740)
1 parent f52829d commit 9b19b09

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

src/imgtiles.jl

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ function mosaic(lon::Vector{<:Float64}, lat::Vector{<:Float64}; pt_radius=637813
407407
for j in nn[1]:nn[2]
408408
quad_[i+mc, j+nc] = getNext(quadtree, quadkey, i, j)
409409
decAdr::Vector{Int} = getQuadLims(quad_[i+mc, j+nc], quadkey, 1)[1]
410-
(provider_code == "nimbo") && (decAdr[2] = 2^zoom - decAdr[2] - 1) # Because Nimbus count y from top (shit)
410+
(provider_code == "nimbo") && (decAdr[2] = 2^zoom - decAdr[2]) # Because Nimbus count y from top (shit)
411411
(isZYX) && (decAdr = [decAdr[2], decAdr[1]]) # Swap x and y because Esri uses z,y,x instead of z,x,y
412412
if (isXeYeZ)
413413
tile_url[i+mc, j+nc] = string(provider_url, decAdr[1], "&y=", decAdr[2], "&z=$(zoom)")
@@ -1039,28 +1039,3 @@ function istilename(s::AbstractString)::Bool
10391039
occursin(r"^[0-3]+$", s) && return true
10401040
return false
10411041
end
1042-
1043-
"""
1044-
binarize(img::AbstractArray{<:Number}, threshold::Real=0.5) -> BitArray
1045-
1046-
Convert an image or array to a binary (0/1) mask using the given threshold.
1047-
1048-
If `img` is a color image (3rd dimension size 3), it is converted to grayscale using the mean across channels.
1049-
The threshold is applied such that values >= threshold are set to 1, others to 0.
1050-
1051-
# Arguments
1052-
- `img`: Input array (2D or 3D).
1053-
- `threshold`: Threshold value (default 0.5).
1054-
1055-
# Returns
1056-
- `BitArray`: Binary mask.
1057-
"""
1058-
function binarize(img::AbstractArray{<:Number}, threshold::Real=0.5)
1059-
if ndims(img) == 3 && size(img,3) == 3
1060-
# Convert to grayscale by averaging channels
1061-
gray = mean(img, dims=3)
1062-
return map(x -> x >= threshold, dropdims(gray; dims=3))
1063-
else
1064-
return map(x -> x >= threshold, img)
1065-
end
1066-
end

0 commit comments

Comments
 (0)