# How to build buffers for each polygon, which requires the buffer area approximately equal the polygon area in Google Earth Engine? [closed]

I want to build buffers for each irregular polygon in featurecollections in Google Earth Engine. The buffer area is required to approximately equal the polygon area. I am very new to GEE.

## closed as unclear what you're asking by Jochen Schwarze, Fran Raga, Vince, whyzar, nmtokenMay 2 at 13:47

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

I don't think there is a "established" way to compute buffer in GEE based on obtaining approximately equal area. Well "approximate" is kind of a loose term but I have gotten more than 1.9 in area of buffered feature and original feature for differently shaped feature with this method.

First, we assume a regular rectangle and try to calculate the buffered area based on that. It should be

original perimeter X buffer distance + 4 x (buffer distance)^2

and that should be equal to the area of the original feature. Since that is a simple quadratic equation, solving that gave me

buffer distance = ( -p + sqrt(p^2 +16a))/8

taking only positive values coz we know we want to grow the feature. So i put that formula in gee. You can see the full code here

``````function bufferequal(feature){
var ar = feature.area();
var perim = feature.perimeter();

var rooted = perim.pow(2).add(ar.multiply(16)).sqrt();
var nomin = rooted.subtract(perim);

var soln = nomin.divide(8);

var buff = feature.buffer(soln);

return buff;
}
``````

The next thing for your question should be how to apply this to each feature of a feature collection. That would be to use this function as a mapping function as follows.

``````var bufferedCollection = yourFeatureCollection.map(bufferequal);
``````

Once again, this WILL NOT give you exactly equal area but since you said you wanted approximate area, i like this method over the iterative methods.