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 relation equals missing in relate()? #1672

Closed
kadyb opened this issue Dec 12, 2024 · 4 comments
Closed

Is relation equals missing in relate()? #1672

kadyb opened this issue Dec 12, 2024 · 4 comments

Comments

@kadyb
Copy link
Contributor

kadyb commented Dec 12, 2024

I wonder if equals relation is missing in relate() function? To check if two geometries are identical, we currently have to extract them as WKT/WKB and compare them using == or identical()?

relation -- character. One of "intersects", "touches", "crosses", "overlaps", "within", "contains", "covers", "coveredby", "disjoint". Or a "DE-9IM" string such as "FFFF***".

@rhijmans
Copy link
Member

You can use compareGeom(x, y)

f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)

compareGeom(v[1:3])
#      [,1]  [,2]  [,3]
#[1,]  TRUE FALSE FALSE
#[2,] FALSE  TRUE FALSE
#[3,] FALSE FALSE  TRUE

compareGeom(v[1:2], v[2:1])
#      [,1]  [,2]
#[1,] FALSE  TRUE
#[2,]  TRUE FALSE

@kadyb
Copy link
Contributor Author

kadyb commented Dec 13, 2024

Ok, I think we should add this information to the relate() doc (#1678).

rhijmans added a commit that referenced this issue Dec 13, 2024
mention `compareGeom()` in `relate.Rd` (for #1672)
@rhijmans
Copy link
Member

And "equals" was indeed missing, and I have added it now (#1678)

@kadyb
Copy link
Contributor Author

kadyb commented Dec 14, 2024

Great, thank you!

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