# Summing up over area based on distance related function?

Through a field study, we learned that the density of a bird species in the forest was related to the distance to forest edge: `ln(density) = 1.89*(distance to edge) + 0.34`

Now, for any forest polygon, how can we estimate the number of birds in it based on above equation?

I thought of using raster approach, dividing the forest into many grids, calculating, and summing up.

But as the forest polygons are highly irregular in shape, there are many "incomplete" polygons. The size of the grid cell and the origin of the grid system influence the output as well. I wonder if there is any approach to this problem using polygons directly?

• You can calculate distances using polygons. But you would still need some kind of spatial structure within the polygon to store the information in. How do you need to present or store the distance data once you have it calculated? This may change the tool that would be best. – Jezibelle Jan 22 '13 at 18:38
• @Jezibelle You're right but this is not easy. The calculation will come down to integrating the density over cells of the polygon's Voronoi diagram. Each cell's boundary will be a union of line segments and parabolic arcs, making the integrals somewhat complicated--if you even get so far as accurately representing the Voronoi diagram in the first place. Because the formula is surely a very rough approximation, the additional precision afforded by this approach does not appear to be worth the effort it would take. – whuber Jan 22 '13 at 20:45

The raster approach is the way to go. There's some information missing, though: your formula needs to indicate what the units of measurement are. Birds per square meter? Per acre? And what is the distance--meters, feet, yards, etc.?

Let's assume you know the units and know how to manage unit conversions. Then you only need to divide the forest polygons into small cells, obtain the distance of each cell to the forest edge, apply the formula for density, convert the density to a count via multiplication by each cell's area, and sum these counts within each polygon.

In detail, the steps are

Begin with a forest polygon layer: The yellow features are forested.

1. Convert the polygons to a raster, assigning a unique identifier to each polygon (for use in the final zonal sum step). The cellsize matters most: small cells provide more precision but require more calculation. When working this out the first time, choose a relatively large cellsize (so that your grid has, say, less than 10^6 cells total). Features are colored by identifier. This grid has 1.5 million cells.

If you have one study area and the forest polygons are not too sparse, it will be expedient to convert the entire area to a single raster: the following calculations will create a result for each polygon represented by that raster. With sparse polygons, to conserve RAM it might be necessary to use several rasters, each focused on a subregion of your study area. Favor the single-raster approach at first, because your time is more valuable than the computer's time.

2. Represent the complement ("outside") of the polygons with a Data-NoData indicator. One way is with the SetNull command. Green values have data; black values are NoData regions.

3. Compute the Euclidean distance grid relative to the complement. (This, the crucial step, is something difficult and time-consuming to do with a non-raster representation of the data.) The distance has been hillshaded to aid the eye. This detail (from the lower right) shows the apparent "ridges" along the medial axes.

4. Apply the formula to the distance grid using the math toolset, multiplying by the squared cellsize to obtain birds per cell. The formula should be in the form

``````cellsize^2 * exp(1.89*("Euclidean distance") + 0.34)
`````` Color now represents number of birds per cell.

Of course you will replace `cellsize^2` by an actual number and "Euclidean distance" by the name of the previously computed grid. This is the point at which to make any change of distance units, by multiplying the distance grid by whatever factor is needed by your formula.

5. Compute the zonal sum of the preceding result, using the polygon grid from step 1 for the zones. This creates a table whose rows correspond to the polygons and one of whose columns (for the sum) gives the estimated bird counts. The polygon ids are in the left column and the zonal sums (bird count estimates) in the right.

If you're worried about the effects of grid origin and cellsize, repeat this calculation while varying those parameters and study the variation in the output. A formula like this is so rough an approximation anyway that considerable variation should be tolerable; given that, and assuming the forest polygons are not extremely tortuous, I would expect the values to be acceptably constant once each polygon has a few dozen cells or more inside it. One reason for this expectation is that the greatest densities (whence the greatest relative contributions to population estimates) are found along the medial axes of the forest polygons and these loci ought to be represented with reasonable accuracy as soon as the polygons are dissected into multiple cells in all directions. (The medial axes will be visually apparent as ridges in the Euclidean distance grid computed in Step 3.)

You could try Multi-Ring Buffers on the polygons, but then you will be restricted to ranges of distances. You could try generating regularly spaced points (try the Create Fishnet tool) and then apply the Spatial Join (with closest option) or the Near tool to calculate distances, but then you will be restricted to the spacing of the points similar to grid cell size.

Also, you will need the distance calculated from inside the forest polygons. To do so, you will want to either convert the polygons to lines (and mask out your calculations inside the original polygons), or create new polygons as the opposite of the current forest polygons (Erase the forest polygons from an extent of the data - or Union and Select if you don't have an ArcInfo license).

The raster approach will tend to be much more efficient: simply create a distance raster from the polygon edge, and then use map algebra in the raster calculator with your equation. You may need to experiment with the cell size.