GeoJSON.jl icon indicating copy to clipboard operation
GeoJSON.jl copied to clipboard

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

Open rafaqz opened this issue 1 year ago • 3 comments

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.

rafaqz avatar May 13 '24 12:05 rafaqz

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

asinghvi17 avatar May 13 '24 12:05 asinghvi17

Probably!

rafaqz avatar May 14 '24 08:05 rafaqz

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.

asinghvi17 avatar Jun 16 '24 03:06 asinghvi17