-
Notifications
You must be signed in to change notification settings - Fork 17
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
Problems with passing geometries to aggregate_spatial
#64
Comments
Thanks for the report. Interesting case.
I'm not sure if all sf objects inherit also from data.frame or if this is a special circumstance when using geojson_sf. That might point in the direction that adding attributes helps, because otherwise the data.frame would be empty. I'm not sure if I can fix this. Maybe I can include a work-around of some sort behind the scenes. I will keep that in mind. |
Now when you said that I was wondering aswell, but it doesn't look like it. |
Additionally, the aggregation doesn't yield the exact same results as if the same See these lines of the process graph, representing the first coordinates each:
JS
edit: Results are then for example: |
aggregate_spatial
The geometries are serialized into text. At that point either the default amount of digits |
During serialization of JSON with jsonlite there was an default value on the number of digits to be used for numbers. Explicitly settint Other than that in future versions of |
I'm trying to pass geometries in
aggregate_spatial
, and it seems that this fails when the passed sf objects don't have any attributes. I'm creating geometries from a GeoJSON string with package geojsonsf like so:to then aggregate
cube_s2_b8_agg <- p$aggregate_spatial(data = cube_s2_b8, reducer = function(data, context) { p$mean(data) }, geometries = pols)
which, upon job submission, fails with a JSON parsing error.
Everything works if I simply add attributes to the sf object (it contains two polygons):
pols$A <- c(4,5)
This seems impractical. Just wanted to report / document the work-around / ask for the reason causing this.
The text was updated successfully, but these errors were encountered: