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

geobuffers created with geobuffer_pts() do not contain all the lat/lon's that were used to created them? #1

Open
gabyrimok opened this issue May 31, 2021 · 1 comment

Comments

@gabyrimok
Copy link

Hello,
I created thousands of buffers using coordinates (EPSG: 4269 (NAD83)) of the presences of amphibian species in North America with the geobuffer_pts function. The problem lies in when I try to randomly sample points within the buffers I created that are not presences of the species; many of the buffer coordinates do not contain any of the lat/lon coordinates of the species' presences used to create them, even when these coordinates and the buffer coordinates are rounded to the first, second, or third decimal place.

For one species (Anaxyrus fowleri), there are 792 presences. And 792 buffers were created accordingly. However, only 179 of these buffers contain the latitudes of this species presences and only 296 of these buffers' longitudes overlap with those of the species presences.

I am not really sure what is going on with the function for this to happen. Any thoughts?

Here is some sample data to try see for yourself:
20_buffer_anaxyrus_fowleri.xlsx
a.fowleri.presences.xlsx

Here is the code I used to run the buffer:
buffer.pres.test <- geobuffer::geobuffer_pts(xy = a.fowleri.presences[,c("Longitude","Latitude")], dist_m = 517626.8, crs = "+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs", output = data.frame)

Here is the code I used to test for overlap in the coordinates between the resulting buffers and the presences of the species:
which(round(a.fowleri.presences$Longitude, 2) == round(a.fowleri.20.buffer$lon, 2)) which(round(a.fowleri.presences$Latitude, 1) == round(a.fowleri.20.buffer$lat, 2))

@valentinitnelav
Copy link
Owner

Hi @gabyrimok , I only saw this issue now. Perhaps you already solved this.

Unfortunately, at a fast look I do not understand the issue. If I understand this correctly, you wanted to test if certain point locations are within the buffer, then you need to do a spatial intersection - see the sf or sp packages for this.

The geobuffer package does one thing only - constructs geodesic buffers, but does not offer spatial operations. These are covered by the sf or sp packages.

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