Skip to content

Can not take the union of polygons generated from buffering of Points #311

Open
@alex-s-gardner

Description

@alex-s-gardner

This is a pretty big issue in my workflow.. to get around it I move over to pure LibGEOS:

import GeoInterface as GI
import GeometryOps as GO
using LibGEOS

pts = GI.Point.([(0.0, 0.0), (5.0, 5.0), (10.0, 0.0), (5.0, -5.0), (0.0, 0.0)])
buffered_pts = GO.buffer(pts, .1)
buffered = reduce(GO.union, buffered_pts)
ERROR: MethodError: no method matching GeometryOpsCore.TraitTarget(::Nothing)
The type `GeometryOpsCore.TraitTarget` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  GeometryOpsCore.TraitTarget(::T) where T<:GeoInterface.AbstractTrait
   @ GeometryOpsCore ~/.julia/packages/GeometryOpsCore/U2GQ1/src/types/traittarget.jl:33
  GeometryOpsCore.TraitTarget(::GeoInterface.AbstractTrait...)
   @ GeometryOpsCore ~/.julia/packages/GeometryOpsCore/U2GQ1/src/types/traittarget.jl:36
  GeometryOpsCore.TraitTarget(::Type{<:GeometryOpsCore.TraitTarget{T}}) where T
   @ GeometryOpsCore ~/.julia/packages/GeometryOpsCore/U2GQ1/src/types/traittarget.jl:35
  ...

Stacktrace:
 [1] union(alg::GeometryOps.FosterHormannClipping{…}, geom_a::GeoInterface.Wrappers.Polygon{…}, geom_b::GeoInterface.Wrappers.Polygon{…}, ::Type{…}; target::Nothing, kwargs::@Kwargs{})
   @ GeometryOps ~/.julia/packages/GeometryOps/avNdd/src/methods/clipping/union.jl:38
 [2] union(geom_a::GeoInterface.Wrappers.Polygon{…}, geom_b::GeoInterface.Wrappers.Polygon{…}, ::Type{…}; target::Nothing, kwargs::@Kwargs{})
   @ GeometryOps ~/.julia/packages/GeometryOps/avNdd/src/methods/clipping/union.jl:49
 [3] union(geom_a::GeoInterface.Wrappers.Polygon{…}, geom_b::GeoInterface.Wrappers.Polygon{…}, ::Type{…})
   @ GeometryOps ~/.julia/packages/GeometryOps/avNdd/src/methods/clipping/union.jl:46
 [4] _mapreduce(f::typeof(identity), op::typeof(GeometryOps.union), ::IndexLinear, A::Vector{…})
   @ Base ./reduce.jl:437
 [5] _mapreduce_dim(f::Function, op::Function, ::Base._InitialValue, A::Vector{GeoInterface.Wrappers.Polygon{…}}, ::Colon)
   @ Base ./reducedim.jl:337
 [6] mapreduce
   @ ./reducedim.jl:329 [inlined]
 [7] reduce(op::Function, A::Vector{GeoInterface.Wrappers.Polygon{false, false, Vector{…}, Nothing, String}})
   @ Base ./reducedim.jl:378
 [8] top-level scope
   @ ~/Documents/GitHub/ItsLivePlayground.jl/src/jink.jl:7
Some type information was truncated. Use `show(err)` to see complete types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions