When is a circle not a circle #2528
Replies: 3 comments 2 replies
-
Please do read the |
Beta Was this translation helpful? Give feedback.
-
I did look at the help for library(sf) # version 1.0.21
sf_use_s2(TRUE) # s2 version 1.1.9
x = data.frame(lon=0,lat=0) |> st_as_sf(coords=c("lon","lat"),crs=4326) |> st_buffer(units::as_units(1,"km"),max_cells=1e5)
y = st_area(x) |> units::set_units("km^2")
y # = 3.141971 [km^2]
error = (as.numeric(y)-pi)/pi
error # = 0.0001205412 = 0.01% Thanks, |
Beta Was this translation helpful? Give feedback.
-
It is hard to strike the balance between too little and too much info. I would say that adding the sentences you had in your response would not hurt things:
I would also suggest perhaps adding some version of my example to the examples of the function. Seeing an example of the effect of Thanks! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I recently used
st_buffer
on a lon,lat point and then calculated the area of that circle and was surprised to find that it didn't agree with the standard formulapi*r^2
even for very small circles. The "error" wasn't huge, but more than 1%, which seems like a lot to me. Am I perhaps misunderstanding how things work? The specific code I ran was:I would think
st_buffer
would get a closer answer than this, but perhaps I am mistaken.Note that though I could probably convert to UTM to get a better answer, my real data has a set of points that are spread all over the globe making using UTM complicated.
Thanks,
David
Beta Was this translation helpful? Give feedback.
All reactions