HOW TO

Count the number of point features within a polygon in ArcMap

Last Published: April 15, 2021

Summary

A common GIS task to perform is counting the number of point features that are contained in a polygon. For example, the image below displays the map of Indonesia with the locations of known significant earthquakes around the country.

A map of Indonesia containing earthquakes locations represented by points.

This workflow explains the steps to determine the number of earthquakes that have occurred in the polygon that represents Indonesia.

Procedure

Note:
For help in determining how to symbolize a map based on the number of point features contained or intersecting a polygon, refer to How To: Symbolize polygons based on the number of intersecting points.

The instructions provided describe how to count the number of point features within a polygon. There are two options available to achieve this:

Use the Spatial Join tool

  1. Navigate to ArcToolbox > Analysis Tools > Overlay > Spatial Join.
The ArcToolbox displaying the Spatial Join tool in the Overlay toolset.
  1. In the Spatial Join dialog box, fill in the required fields and parameters as follow:
    1. Target Features: Polygon layer
    2. Join Features: Point features
    3. Join Operation (optional): JOIN_ONE_TO_ONE and check the Keep All Target Features (optional) option.
    4. Match Option (optional): COMPLETELY_CONTAINS. For this option, the point features in the join features are matched when a polygon target feature completely contains them.
    5. Leave other parameters as default.
The Spatial Join tool window displaying the Target Features, Join Features, Join Operation (optional), and Match Option (optional) parameters. Click OK after defining all the required parameters.
  1. Click OK to run the tool.
  2. Open the attribute table for the join output, and look for the Join_Count field. The number in the field represents the number of point features within the polygon, which in this example is the number of earthquakes that occurred in Indonesia.
Output for the Spatial Join tool in an attribute table displaying the Joint_Count field.

Create a count field and a spatial join between the point shapefile and the polygon shapefile

  1. In the attribute table of the point shapefile, create a field called 'Count' of type 'Short Integer'.
  2. Calculate the Count field to equal to 1 by right-clicking the field name, and clicking Field Calculator.
  3. Type the integer 1 in the white dialog area below Count = , and click OK.
The Field Calculator window displaying the Count field's expression box, and the integer input, 1. Click OK to run the tool.
  1. Right-click the polygon shapefile and click Joins and Relates > Joins. Click the drop-down list and select Join data from another layer based on spatial location.
  2. Specify the point shapefile from Step 1.
  3. Select the first bullet, Each polygon is given a summary of the numeric attributes..., and check the Sum box.
  4. Specify an output location, and click OK.
  5. A polygon shapefile with the 'Count' field indicating how many point features lie within each polygon feature is now present. This is usually named 'Sum_Count' or 'Count_'.

Article ID:000008599

Software:
  • ArcMap

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options