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

Fix issue with subexercise 10 of canopy height from space #1102

Open
ethanwhite opened this issue Nov 10, 2024 · 0 comments
Open

Fix issue with subexercise 10 of canopy height from space #1102

ethanwhite opened this issue Nov 10, 2024 · 0 comments

Comments

@ethanwhite
Copy link
Member

ethanwhite commented Nov 10, 2024

It turns out there is a complexity with exercise 1.10 if you use st_join to assemble the combined sf object. If you use mutate everything will work as expected.

By default st_join will count any two objects as matching that intersect one another. The size of the buffer we added resulted in the buffered circles (polygons) for plot_id's 3 and 7 overlapping at an edge and so the spatial join included a line for plot_id 3 with plot_id 7's information and a line for plot_id 7 with plot_id 3's information. This results in extra points showing up the graphs and incorrect averages.

This can be fixed by adding an optional argument to the spatial joins so that instead of matching objects that intersect it only matches objects that are the same:

sjer_plots_canopyheight <- st_join(sjer_plots_buffered, sjer_canopyheight, join = st_equals)
sjer_plots_canopyheight_elevation <- st_join(sjer_plots_canopyheight, sjer_elevation, join = st_equals)

It's fine to just submit with the extra points, we'll give that full credit, but if you'd like to fix it with follow the code above or switch to using mutate to build the combined sf object.

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

1 participant