1

For a specific size of area (e.g. 1km squared), I want to apply formulas to a feature collection.

These formulas aren't included in the reducers available. For example, I want to get the circular mean and circular variance of the angles of the edges of polygons in each 1km squared, while reducers just include regular mean and variance.

Is there any way for me to make my own reducer? Or to achieve this some other way?

For context: Here is the code I use to apply the formulas to a specific area https://code.earthengine.google.com/6600a883f18100443ca33635f4c3e71d, now I want to generalize that area to each 1km squared in a region.

7
  • No, you can't create a custom reducer. But assuming you had the appropriate reducer, how would you expect to do this? map over a big collection of 1km cells, doing a filterBounds for each? Commented Aug 21, 2021 at 13:15
  • I was thinking reduceToImage using that reducer and a 1000m scale - would that work?
    – Emma
    Commented Aug 21, 2021 at 13:50
  • It might work if you had a feature per edge, each with an angle (do-able; you just need to map over the buildings producing a collection of edges/angles); but once you have that, you can just do the circular mean math yourself by summing the sines and cosines of the angle into the image directly. Commented Aug 21, 2021 at 22:24
  • I did what you suggested, and now have angles represented in an image. To sum the sines I use: sin_angles.reduceRegion({reducer: ee.Reducer.sum(), geometry: block, scale: 50}), is this correct? I'm getting some strange results. The code can also be seen here (line 182): code.earthengine.google.com/e1850bf0d52f371da62755e4d92e4187
    – Emma
    Commented Aug 22, 2021 at 10:15
  • You can't reduce the angles into an image, you have to convert to sines and cosines and reduce those into an image by summing. Commented Aug 22, 2021 at 14:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.