Summarize Within

Summarize Within icon The Summarize Within tool calculates statistics in areas where an input layer is within or overlaps a boundary layer. The area you are summarizing within can be an area layer or a hexagonal or square bin.

Workflow diagram

Summarize Within workflow diagram

Examples

  • A cable provider is starting a pilot program that provides low-cost Internet access to low-income community college students. Summarize Within by Bins can be used to determine the number of low-income students within square bins of a defined size so the cable provider can choose an appropriate region for its pilot program.
  • To complete routine maintenance projects efficiently, the city uses Summarize Within to count the street lights and to sum the miles of bike lanes within each maintenance assessment district. It can then estimate the material and staff needed to complete the work in each district.

Usage notes

  • The input layer to be summarized can be a point, line, or polygon layer.
  • The output layer is always a polygon area or bin layer and only the area or bin features where summarized features occur are returned.
  • You can think of Summarize Within taking two layers, the area features and the input summary features, and stacking them on top of each other. After stacking these layers, you peer down through the stack and count the number of input summary features that fall within the areas. Not only can you count the number of features, you can calculate simple statistics about the attributes of the input summary features such as sum, mean, minimum, maximum, and more.
  • Summarize Within can calculate standard statistics and geographically weighted statistics. Standard statistics summarize the statistical values without any weighting. Weighted statistics calculate values using the geographically weighted values of the proportion of lines within a polygon, or proportion of polygons within a polygon. Weighted statistics do not apply to points within polygons.

How Summarize Within works

Equations

For summarized line and area features, weighted statistics incorporate Summary Area weights. None of the statistics for point features are weighted. The following table shows the equations used to calculate variance and the weighted mean.

StatisticEquationVariablesFeatures

Variance

Variance equationVariance variables

Points

Weighted Mean

Weighted mean equation

Weighted mean variables

Weights are calculated as the percentage of the feature i within the summary area.

Lines and Areas

Points

Point layers are summarized using only the point features that fall within the Summary Area. Weighted statistics cannot be applied when summarizing points.

The figure and table below explain the statistical calculations of a point Summarized Layer within hypothetical areas. The Population field was used to calculate the statistics (Count, Sum, Minimum, Maximum, Range, Mean, Standard Deviation, and Variance) for the layer.

Summarizing a point layer
Point layers are summarized using only points located within the area layer. An example attribute table is displayed above with values to be used in hypothetical statistic calculations.

Numeric statisticResults District A

Count

Count of:

[280, 408, 356, 361, 450, 713] = 6

Sum

280 + 408 + 356 + 361 + 450 + 713 = 2,568

Minimum

Minimum of:

[280, 408, 356, 361, 450, 713] = 280

Maximum

Maximum of:

[280, 408, 356, 361, 450, 713] = 713

Range

713 - 280 = 433

Mean

2568/6 = 428

Variance

Variance of points
= 22737.2

Standard Deviation

Standard deviation of points
= 150.7886

String statisticResults District A

Count

= 6

Any

= Secondary School

Note:

The count statistic (for strings and numeric fields) counts the number of nonnull values. The counts of [0, 1, 10, 5, null, 6] = 5. The count of [Primary, Primary, Secondary, null] = 3.

A real-life scenario in which this analysis could be used is in determining the total number of students in each school district. Each point represents a school. The Type field gives the type of school (elementary, middle school, or secondary) and a student population field gives the number of students enrolled at each school. The calculations and results are given for District A in the table above. From the results, you can see that District A has 2,568 students. When running the Summarize Within tool, the results would also be given for District B.

Lines

For weighted statistics, line layers are summarized using only the proportions of line features that are within the Summary Area. Standard (non-weighted) statistics summarize any line intersecting the Summary Area. When summarizing lines using weighted statistics, use counts and amounts (rather than rates or indices) so proportional calculations make logical sense in your analysis.

The figure and table below explain the statistical calculations of a line Summarized Layer within a hypothetical Summary Area. The Volume field was used to calculate the statistics (Count, Sum, Minimum, Maximum, Range, Mean, Standard Deviation, and Variance) for the layer. The standard statistics are calculated using lines that intersect the boundary and the weighted statistics are calculated using the proportion of the lines that are within the Summary Area. Standard Deviation and Variance are only available for standard statistics.

Summarizing a line layer
Line layers are summarized using standard statistics and weighted statistics as shown below

Numeric statisticsStandard statisticsWeighted statistics

Calculating Weights

Not applicable

Weight of the brown line (value = 600):

2/3 = .3333

Weight of the blue line (value = 1000):

3/6 = .5

Count

Count of:

[1000, 600] = 2

Count of:

1 x (3/6) + 1 x (2/3) = 1.667

Sum

1000 + 600 = 1600
1000 x (3/6) + 600 x (2/3) = 900

Minimum

Minimum of:

[1000, 600] = 600

Minimum of:

[1000 x (3/6), 600 x (2/3)]
[500, 400] = 400

Maximum

Maximum of:

[1000, 600] = 1000

Maximum of:

[1000 x (3/6), 600 x (2/3)]
[500, 400] = 500

Range

1600 - 600 = 1000
500 - 400 = 100

Mean

(1000 + 600)/2 = 800
(1000 x (3/6) + 600 x (2/3))/(3/6 + 2/3) 
(500 + 400)/(4/6) = 1350

Variance

Variance of lines
= 80000

Not applicable

Standard Deviation

Standard deviation of lines
= 282.8427

Not applicable

A real-life scenario in which this analysis could be used is in determining the total volume of water in rivers within the boundaries of a state park. Each line represents a river that is partially located inside the park. From the results, you can see that there are 5 miles of rivers within the park and the total volume is 900 units.

Areas

Area layers are summarized using only the proportions of the area features that are within the input boundary. When summarizing areas, use fields with absolute numbers so proportional calculations make logical sense in your analysis.

Weighted statistics for summarized area layers are based on the proportions of the Summary Area features that are within the Summarized Layer. When summarizing areas, use counts or amounts (rather than rates or indices) so proportional calculations make logical sense in your analysis.

The figure and table below explain the statistical calculations of an area layer within a hypothetical Summary Area. The population field was used to calculate the statistics (Count, Sum, Minimum, Maximum, Range, Mean, Standard Deviation, and Variance) for the layer. The standard statistics are calculated using areas that intersect the Summary Area, and the weighted statistics are calculated using a proportional weight based on the portion of summary areas contained within each Summarized Layer. Standard Deviation and Variance are only available for standard statistics.

Summarizing an area layer
Summary statistics are computed for areas in the summarized layer that intersect the summary areas. Weights for weighted statistics are based on the proportion of the summary areas that overlap the summarized layer features.

Numeric statisticsStandard statistics: Results Neighborhood 1Weighted statistics: Results Neighborhood 1

Calculating Weights

Weight of the yellow area (value = 3200):

4/(2+4) = 3/4

Weight of the green area (value = 4700):

4/(2+4) = 2/3

Weight of the pink area (value = 1000):

1/(1+1.5) = 2/5

Weight of the blue area (value = 4500):

6/(2+6) = 3/4

Weight of the orange area (value = 3600):

2/(2+2) = 1/2

Count

Count of:

[3200, 4700, 1000, 4500, 3600] = 5

Count of:

(3/4)+(2/3)+ (2/5)+(3/4)+ (1/2) = 3.06667

Sum

3200 + 4700 + 1000 + 4500 + 3600 = 17000
(3/4) x 3200 +(2/3) x 4700 + (2/5) x 1000 +(3/4) x 4500 + (1/2) x 3600 = 11108.33

Minimum

Minimum of:

[3200, 4700, 1000, 4500, 3600] = 1000

Minimum of:

[(3/4) x 3200, (2/3) x 4700, (2/5) x 1000, (3/4) x 4500, (1/2) x 3600]
[2400, 3133.33, 400, 3375, 1800] = 400

Maximum

Maximum of:

3200, 4700, 1000, 4500, 3600] = 4700

Maximum of:

[2400, 3133.33, 400, 3375, 1800] = 3375

Range

4700 - 1000 = 3700
3,375 - 400 = 2,975

Mean

(17000)/5 = 3400
(11108.33)/[3.06667] = 3622.83

Variance

Variance of areas
= 2185000

Not applicable

Standard Deviation

Standard deviation of areas
= 1478.175

Not applicable

Parameters

ParameterExplanationData Type

Input Layer

The point, line, or polygon features that will be summarized within area features.

Features

Bin Type

The bin shape that will be used to create the regular bins. Choices are Square or Hexagon.

If a polygon source is connected to the join port of this tool, this parameter will no longer appear or be required.

String

Bin Size

The distance interval that represents the bin size into which the input points will be aggregated. For square bins, the bin size represents the height of a square. This is the default. For hexagonal bins, the bin size represents the height between two parallel sides.

If a polygon source is connected to the join port of this tool, this parameter will no longer appear or be required.

String

Summarize Shapes

Whether or not to summarize shape information as part of the analysis (length of lines or area of polygons). If the input summary features are points, there is no shape information to summarize. Only the count of points within each area feature is added.

Boolean

Shape Units

The unit in which to calculate shape summary attributes. If the input summary features are lines, specify a linear unit. If the input summary features are polygons, specify an areal unit.

String

Summary Fields

The statistics that will be calculated for specified fields. Different statistics are available depending on whether the specified field is a string, numeric, or date field.

  • ANY - This is a sample string from a field of type string.
  • COUNT - Calculates the number of nonnull values. It can be used on numeric fields or strings. The count of [null, 0, 2] is 2.
  • COUNT DISTINCT - Calculates the number of distinct, nonnull values. It can be used on numeric fields or strings. The count distinct result of [null, 4, 3, 4] is 2.
  • SUM - The sum of numeric values in a field. The sum of [null, 1, 3] is 4.
  • SUM OF SQUARES - The sum, over all observations, of the squared differences of each observation from the overall mean. The sum of squares of [null, 2.2, 3.1, 4.7] is 3.206.
  • MIN - The minimum value of a numeric field. The minimum of [0, 2, null] is 0.
  • MAX - The maximum value of a numeric field. The maximum value of [0, 2, null] is 2.
  • MEAN - The mean of numeric values. The mean of [0,2, null] is 1.
  • RANGE - The range of a numeric field. This is calculated as the minimum value subtracted from the maximum value. The range of [0, null, 1] is 1. The range of [null, 4] is 0.
  • VARIANCE - The variance of a numeric field in a track. The variance of [1] is null. The variance of [null, 1,1,1] is 1.
  • STANDARD DEVIATION - The standard deviation of a numeric field. The standard deviation of [1] is null. The standard deviation of [null, 1,1,1] is 1.

String

Weighted Statistics

The geographically weighted statistics that will be calculated for specified fields. Weighted statistics calculate values using the geographically weighted values of the proportion of lines within a polygon, or proportion of polygons within a polygon. Weighted statistics do not apply to points within polygons. Different statistics are available depending if the specified field is a string, numeric, or date field.

  • COUNT - Calculates the number of nonnull values. It can be used on numeric fields or strings. The count of [null, 0, 2] is 2.
  • SUM - The sum of numeric values in a field. The sum of [null, 1, 3] is 4.
  • MIN - The minimum value of a numeric field. The minimum of [0, 2, null] is 0.
  • MAX - The maximum value of a numeric field. The maximum value of [0, 2, null] is 2.
  • MEAN - The mean of numeric values. The mean of [0,2, null] is 1.
  • RANGE - The range of a numeric field. This is calculated as the minimum value subtracted from the maximum value. The range of [0, null, 1] is 1. The range of [null, 4] is 0.

String

Output layer

The output layer will contain the following field in place of the original fields. If you chose to configure Summary fields, those fields would also be calculated for the output layer.

Field NameDescriptionField Type

COUNT

The number of features from the input layer that were summarized into this polygon bin.

Float64

sum_length_<units>

If the input layer is a polyline feature, and the Summarize Shapes parameters is set to Yes, the output will generate this field that reports the total length of polyline features within each bin, in the units specified by the Shape Units parameter.

Float64

sum_area_<units>

If the input layer is a polygon feature, and the Summarize Shapes parameter is set to Yes, the output will generate this field that reports the total area of polygon features within each bin, in the units specified by the Shape Units parameter.

Float64

Considerations and limitations

  • Lines and areas are summarized using proportions, therefore, it is best to summarize absolute data (such as population) rather than relative data (such as average income) when lines or areas are being summarized.