Skip to content

Commit

Permalink
Add crs is nothing fallback for non-geointerface types (#116)
Browse files Browse the repository at this point in the history
* add crs nothing fallback

* be explicit
  • Loading branch information
rafaqz authored Dec 21, 2023
1 parent a4821e2 commit 1ae419f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/fallbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ issimple(t::AbstractMultiPointTrait, geom) = allunique((getgeom(t, geom)))
issimple(t::AbstractMultiCurveTrait, geom) = all(issimple.(getgeom(t, geom)))
isclosed(t::AbstractMultiCurveTrait, geom) = all(isclosed.(getgeom(t, geom)))

crs(::Nothing, geom) = nothing
crs(::AbstractTrait, geom) = nothing

# FeatureCollection
Expand Down
5 changes: 5 additions & 0 deletions test/test_primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,11 @@ end

end

@testset "extent and crs fallback to nothing on unknown objects" begin
@test isnothing(GeoInterface.crs(nothing))
@test isnothing(GeoInterface.extent(nothing))
end

module ConvertTestModule
using GeoInterface
struct TestPolygon end
Expand Down

0 comments on commit 1ae419f

Please sign in to comment.