diff --git a/src/primitives.jl b/src/primitives.jl index ff66666e5..ae02dcc18 100644 --- a/src/primitives.jl +++ b/src/primitives.jl @@ -1,5 +1,7 @@ # # Primitive functions +export apply, applyreduce, TraitTarget + # This file mainly defines the [`apply`](@ref) function and its relatives. #= diff --git a/src/transformations/correction/geometry_correction.jl b/src/transformations/correction/geometry_correction.jl index 1bbef6fe9..5cccb5ea2 100644 --- a/src/transformations/correction/geometry_correction.jl +++ b/src/transformations/correction/geometry_correction.jl @@ -50,7 +50,7 @@ function fix(geometry; corrections = GeometryCorrection[ClosedRing(),], kwargs.. for Trait in (GI.PointTrait, GI.MultiPointTrait, GI.LineStringTrait, GI.LinearRingTrait, GI.MultiLineStringTrait, GI.PolygonTrait, GI.MultiPolygonTrait) available_corrections = findall(x -> x == Trait, traits) isempty(available_corrections) && continue - println("Correcting for $(Trait)") + @debug "Correcting for $(Trait)" net_function = reduce(∘, corrections[available_corrections]) final_geometry = apply(net_function, Trait, final_geometry; kwargs...) end diff --git a/src/transformations/reproject.jl b/src/transformations/reproject.jl index c9bc7b391..270076ed5 100644 --- a/src/transformations/reproject.jl +++ b/src/transformations/reproject.jl @@ -44,7 +44,7 @@ function reproject end # prints a suggestion if the Proj extension is not loaded. function _reproject_error_hinter(io, exc, argtypes, kwargs) - if isnothing(Base.get_extension(GeometryOps, :GeometryOpsProjExt)) + if isnothing(Base.get_extension(GeometryOps, :GeometryOpsProjExt)) && exc.f == reproject print(io, "\n\nThe `reproject` method requires the Proj.jl package to be explicitly loaded.\n") print(io, "You can do this by simply typing ") printstyled(io, "using Proj"; color = :cyan, bold = true) diff --git a/src/transformations/simplify.jl b/src/transformations/simplify.jl index 9ab10e9a9..8ad5b25da 100644 --- a/src/transformations/simplify.jl +++ b/src/transformations/simplify.jl @@ -42,7 +42,9 @@ usa_poly = GI.getgeom(usa_multipoly, findmax(GO.area.(GI.getgeom(usa_multipoly)) usa_centroid = GO.centroid(usa_poly) usa_reflected = GO.apply(Translation(usa_centroid...) ∘ LinearMap(Makie.rotmatrix2d(π)) ∘ Translation((-).(usa_centroid)...) ∘ GO.Point2{Float64}, PointTrait, usa_poly) f, a, p = plot(usa_poly; label = "Original"); plot!(usa_reflected; label = "Reflected") - +``` +This is the complex polygon we'll be benchmarking. +```@example benchmark simplify_suite = BenchmarkGroup(["Simplify"]) singlepoly_suite = BenchmarkGroup(["Polygon", "title:Polygon simplify", "subtitle:Random blob"]) multipoly_suite = BenchmarkGroup(["MultiPolygon", "title:Multipolygon simplify", "subtitle:USA multipolygon"])