Skip to content

Commit d214e8c

Browse files
authored
Merge pull request #6 from JuliaGeo/fix/union-missing
Fix correct dimensionality
2 parents 51a7911 + 4b5998e commit d214e8c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/arrow.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ ArrowTypes.fromarrow(::Type{GeoFormatTypes.WellKnownBinary}, x) = GeoFormatTypes
8686
ArrowTypes.fromarrow(::Type{GeoFormatTypes.WellKnownText}, x) = GeoFormatTypes.WellKnownText(GeoFormatTypes.Geom(), String(x)) # should be StringView
8787
function ArrowTypes.fromarrow(::Type{Geometry{X}}, x) where {X}
8888
nt = nested_eltype(x)
89-
D = length(nonmissingtype(nt).types)
89+
D = length(nt.types)
9090
return Geometry{X,D,Float64}(x)
9191
end
9292
function fromarrow(::Type{GeoArrow.Geometry{X}}, nt::NamedTuple) where X
@@ -95,6 +95,7 @@ end
9595
ArrowTypes.fromarrow(::Type{Extents.Extent}, x) = Extents.Extent(X=(x.xmin, x.xmax), Y=(x.ymin, x.ymax))
9696

9797
nested_eltype(x) = nested_eltype(typeof(x))
98+
nested_eltype(::Type{Union{Missing,T}}) where {T} = nested_eltype(T)
9899
nested_eltype(::Type{T}) where {T<:AbstractArray} = nested_eltype(eltype(T))
99100
nested_eltype(::Type{T}) where {T} = T
100101

src/type.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ GeoInterface.ngeom(_, g::Geometry) = length(g.geom)
2121
GeoInterface.ngeom(t, g::Geometry{X,D,T,<:GeoFormatTypes.MixedFormat}) where {X,D,T} = ngeom(t, g.geom)
2222
GeoInterface.getgeom(_, g::Geometry, i) = Base.getindex(g, i)
2323
GeoInterface.getgeom(t, g::Geometry{X,D,T,<:GeoFormatTypes.MixedFormat}, i) where {X,D,T} = getgeom(t, g.geom, i)
24+
GeoInterface.isempty(::GeoInterface.AbstractGeometryTrait, g::Geometry) = length(g.geom) == 0
2425

2526
# coordtype implementation
2627
if :coordtype in names(GeoInterface; all = true)

0 commit comments

Comments
 (0)