Skip to content

Commit 1e8ea6d

Browse files
committed
Merge branch 'main' into breaking
2 parents e846044 + b89b0b6 commit 1e8ea6d

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Adapt = "2, 3.0, 4"
5454
Aqua = "0.8"
5555
ArchGDAL = "0.9, 0.10"
5656
CFTime = "0.1"
57-
ColorTypes = "0.10, 0.11"
57+
ColorTypes = "0.10, 0.11, 0.12"
5858
CommonDataModel = "0.2.3, 0.3"
5959
ConstructionBase = "1"
6060
CoordinateTransformations = "0.6.2"
@@ -106,6 +106,7 @@ RasterDataSources = "3cb90ccd-e1b6-4867-9617-4276c8b2ca36"
106106
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
107107
Shapefile = "8e980c4a-a4fe-5da2-b3a7-4b4b0353a2f4"
108108
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
109+
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
109110
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
110111
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
111112

src/methods/extract.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,11 @@ function _extract(A::RasterStackOrArray, e::Extractor, id::Int, geom; kw...)
187187
_extract(A, e, id, GI.geomtrait(geom), geom; kw...)
188188
end
189189
function _extract(A::RasterStackOrArray, e::Extractor{T}, id::Int, ::Nothing, geoms::AbstractArray;
190-
threaded=false, progress=true, kw...
190+
threaded=false, progress=true, skipmissing, kw...
191191
) where T
192-
# Handle emptycases
193-
isempty(geoms) && return T[]
194-
195-
geom1 = all(ismissing, geoms) ? missing : first(skipmissing(geoms))
196-
trait1 = GI.trait(geom1)
192+
# Handle empty / all missing cases
193+
isempty(geoms) || all(ismissing, geoms) && return T[]
194+
trait1 = GI.trait(first(Base.skipmissing(geoms)))
197195
# We split out points from other geoms for performance
198196
if trait1 isa GI.PointTrait
199197
allpoints = true

src/utils.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,12 @@ function _get_geometries(data, ::Nothing)
211211
data
212212
else
213213
trait = GI.trait(data)
214-
if GI.trait(data) isa GI.FeatureCollectionTrait
214+
if trait isa GI.FeatureCollectionTrait
215215
[GI.geometry(f) for f in GI.getfeature(data)]
216-
else
216+
elseif isnothing(trait)
217217
collect(data)
218+
else
219+
data
218220
end
219221
end
220222
# check if data iterates valid geometries before returning
@@ -240,9 +242,10 @@ function _get_geometries(data, geometrycolumn::NTuple{<:Any, <:Symbol})
240242
return points
241243
end
242244
function _check_geometries(geoms)
245+
!isnothing(GI.trait(geoms)) && return
243246
for g in geoms
244-
ismissing(g) || GI.geomtrait(g) !== nothing ||
245-
throw(ArgumentError("$g is not a valid GeoInterface.jl geometry"))
247+
ismissing(g) || !isnothing(GI.geomtrait(g)) ||
248+
throw(ArgumentError("$g is not a valid GeoInterface.jl geometry"))
246249
end
247250
return
248251
end

0 commit comments

Comments
 (0)