We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
NaturalIndexing.prepare_naturally
1 parent dea7093 commit c187e37Copy full SHA for c187e37
src/utils/NaturalIndexing.jl
@@ -237,8 +237,11 @@ GI.isgeometry(::Type{<: NaturallyIndexedRing}) = true
237
GI.geomtrait(::NaturallyIndexedRing) = GI.LinearRingTrait()
238
239
function prepare_naturally(geom)
240
- return GO.apply(GI.PolygonTrait(), geom) do poly
241
- return GI.Polygon([GI.convert(NaturallyIndexedRing, GI.LinearRingTrait(), ring) for ring in GI.getring(poly)])
+ crs = GI.crs(geom)
+ return GO.apply(GI.PolygonTrait(), geom; calc_extent = true) do poly
242
+ rings = [GI.convert(NaturallyIndexedRing, GI.LinearRingTrait(), ring) for ring in GI.getring(poly)]
243
+ extent = mapreduce(GI.extent, Extents.union, rings)
244
+ return GI.Polygon(rings; extent, crs)
245
end
246
247
0 commit comments