Is there any way to draw a rectangle on a map, select all the points within the rectangle and then find the average of the values?
I want the user to be able to "design" their own solar panel and get a verdict if the location is good or not.

I know that I can buffer pixels around a selected point but I would rather be able to draw my own area.
I am not sure where to start? Any ideas would be helpful!
Thanks!
I have found this template:
Layer in a map service - [ON-DEMAND]
If I go with this one, is there a way to have sum (or average) display in a popup not at the bottom of the screen?