File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,28 @@ function GI.convert(
176176 Polygon[GI. convert (Polygon, PolygonTrait (), g; context) for g in GI. getgeom (geom)]
177177 return MultiPolygon (polygons)
178178end
179+ GI. convert (
180+ :: Type{GeometryCollection} ,
181+ :: GeometryCollectionTrait ,
182+ geom:: GeometryCollection ;
183+ context = nothing ,
184+ ) = geom
185+ function GI. convert (
186+ :: Type{GeometryCollection} ,
187+ :: GeometryCollectionTrait ,
188+ geom;
189+ context = get_global_context (),
190+ )
191+ geometries = map (GI. getgeom (geom)) do g
192+ t = GI. trait (g)
193+ lg = geointerface_geomtype (t)
194+ # We call the full invocation for LibGEOS directly,
195+ # so the context can be passed through, since
196+ # `GI.convert(Mod, x)` does not allow kwargs.
197+ GI. convert (lg, t, g; context)
198+ end
199+ return GeometryCollection (geometries)
200+ end
179201
180202function GI. convert (
181203 t:: Type{<:AbstractGeometry} ,
Original file line number Diff line number Diff line change @@ -129,6 +129,9 @@ const LG = LibGEOS
129129 # Plots.plot(lr)
130130 # Makie.plot(lr)
131131
132+ gi_gc = GeoInterface. GeometryCollection ([ls, mls, pt])
133+ @test GeoInterface. convert (LibGEOS, gi_gc) isa LibGEOS. GeometryCollection
134+
132135 @inferred GeoInterface. ncoord (lr)
133136 @inferred GeoInterface. ngeom (lr)
134137 @inferred GeoInterface. getgeom (lr)
You can’t perform that action at this time.
0 commit comments