JuliaGeo / GeoJSON.jl

Utilities for working with GeoJSON data in Julia
https://juliageo.org/GeoJSON.jl/stable/
MIT License
68 stars 10 forks source link

Allow `write` for ` Vector` or even other itererables of geometries. #92

Open rafaqz opened 1 month ago

rafaqz commented 1 month ago

It would be nice if arrays/iterables of geometries would just write as a GeometryCollection without having to explicitly wrap them as that, as its a common way to hold and manipulate geometries you are working on.

asinghvi17 commented 1 month ago

Wouldn't the correct handling for this be a FeatureCollection with no attributes?

rafaqz commented 1 month ago

Probably!

asinghvi17 commented 2 weeks ago
function vec2fc(vec)
    @assert all(x -> !isnothing(GI.geomtrait(x)), vec)
    fc = GI.FeatureCollection(GI.Feature.(vec; properties = (;))
end

ought to work as the core conversion method, if someone wants to take this up.