Skip to content

Commit

Permalink
Allow Feature without properties (#165)
Browse files Browse the repository at this point in the history
* bugfix feature with no properties
  • Loading branch information
rafaqz authored Sep 25, 2024
1 parent f43bb88 commit 34dafb7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ function Feature(f::Feature; crs=crs(f), extent=f.extent, properties=nothing)
isnothing(properties) || @info "`properties` keyword not used when wrapping a feature"
Feature(parent(f), crs, extent)
end
function Feature(geometry=nothing; properties=nothing, crs=nothing, extent=nothing)
function Feature(geometry=nothing; properties=(;), crs=nothing, extent=nothing)
if isnothing(geometry) || isgeometry(geometry)
# Wrap a NamedTuple feature
Feature((; geometry, properties...), crs, extent)
Expand Down
1 change: 1 addition & 0 deletions test/test_wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ feature = GI.Feature(multipolygon;
@test GI.extent(feature) == GI.extent(multipolygon)
@test GI.testfeature(feature)
@test_throws ArgumentError GI.Feature(:not_a_feature; properties=(x=1, y=2, z=3))
@test GI.properties(GI.Feature(multipolygon)) == NamedTuple()

# Feature Collection
fc_unwrapped = GI.FeatureCollection(feature; crs=EPSG(4326), extent=GI.extent(feature))
Expand Down

0 comments on commit 34dafb7

Please sign in to comment.