Skip to content

Issue with intersects predicate for spatial joins #147

Open
@pierrethiriet

Description

@pierrethiriet

I am currently testing GeometryOps package to move away from R and the sf package for GIS work. I am facing a minor issue (misusage or bug ?) while using the spatial join function.
The following example with GO.within is working as expected :

using FlexiJoins, DataFrames
import GeoInterface as GI
import GeometryOps as GO

pl = GI.Polygon([GI.LinearRing([(0, 0), (1, 0), (1, 1), (0, 0)])])
pu = GI.Polygon([GI.LinearRing([(0, 0), (0, 1), (1, 1), (0, 0)])])
poly_df = DataFrame(geometry = [pl, pu], color = [:red, :blue])
points = tuple.(rand(1000), rand(1000))
points_df = DataFrame(geometry = points)

joined_df_within = FlexiJoins.innerjoin(
 (points_df, poly_df),
    by_pred(:geometry, GO.within, :geometry)
)

But the GO.intersects predicate fails :

joined_df_intersects = FlexiJoins.innerjoin(
 (points_df, poly_df),
    by_pred(:geometry, GO.intersects, :geometry)
)

Giving the following error:

ERROR: MethodError: no method matching 
swap_sides(::typeof(GeometryOps.intersects))

While the predicate is otherwise working as expected

[GO.intersects(g1, g2) for g1 in points_df.geometry for g2 in poly_df.geometry]

The versions used are the following :

Julia 1.10
  [e37f2e79] FlexiJoins v0.1.33       
  [cf35fbd7] GeoInterface v1.3.4      
  [3251bfac] GeometryOps v0.1.5  

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjuliaconTo be implemented for JuliaCon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions