Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it expected that MultiPoint within a Polygon returns only a single true/false #188

Closed
alex-s-gardner opened this issue Oct 10, 2023 · 1 comment

Comments

@alex-s-gardner
Copy link
Contributor

alex-s-gardner commented Oct 10, 2023

I would have expected LibGEOS.within(g1::MultiPoint, g2::POLYGON) to return a Bool of length(g1.geom), but this is not the case:

# specify 3 points
julia> g1 = GeoInterface.MultiPoint([(0.5, 0.5); (2., 2.); (0.25, 0.25)])
GeoInterface.Wrappers.MultiPoint{false, false, Vector{Tuple{Float64, Float64}}, Nothing, Nothing}([(0.5, 0.5), (2.0, 2.0), (0.25, 0.25)], nothing, nothing)

# create a Polygon
julia> g2 = readgeom("POLYGON((0 0,1 0,1 1,0 0))")
POLYGON ((0 0, 1 0, 1 1, 0 0))

# check if points are in polygon
julia> LibGEOS.within(g1, g2)
false
@evetion
Copy link
Member

evetion commented Oct 10, 2023

The above example does not work on my versions of the software. Nonetheless, this is expected, you ask whether a MultiPoint is within the Polygon (per docstring, whether a is in b -> bool), and it's not.

We could improve the documentation, predicates in Python have slightly better definitions, like

Returns True if geometry A is completely inside geometry B.

If you want to receive the individual results, split the multipoint into its individual points.

@evetion evetion closed this as completed Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants