I have a grid of polygons and a shapefile with several types of points (POIs). Now I would like to count the number of POI classes lying within each polygon?

With spatial join I only managed to get the total number of POIs within one polygon.

Does anyone have an idea? I use ArcGIS 10.5

2 Answers 2


Your half way there, try these steps:

  1. Spatially join the polygon grid layer to the POI point layer
  2. Create a new text field in the join result point layer
  3. Field calculate and concatenate the grid ID field with the POI class field (something like [gridID]&"-"&[POIClassField]) make sure you concatenate the two with some sort of deliminator for example I used the dash character "-"
  4. Right click in attribute table on new field name from step 2 and select Summarize
  5. Open summary table and add another text field (numClasses) and field calculate it and split out the grid ID values (using python parser code below) (spliting to left of dash character "-")

enter image description here

  1. Finally, right click in attribute table on new field name (numClasses) from step 5 and select Summarize

This will produce a summary table of number of unique POI classes within each grid.

enter image description here

  • Thanks! with these suggested steps, as far as I understand, I will get the number of each POI class of each polygon, right? What I actually want to get is the number of POI classes in each polygon, so for instance: Polygon A has 2 hotels, 1 Bar and 3 restaurants --> the number would be 3 (I dont care about the number of each POI class) is there a way to calculate these numbers?
    – Sebastian
    Commented Dec 8, 2017 at 14:31
  • yes, updated my answer added two more steps per your comment
    – artwork21
    Commented Dec 8, 2017 at 15:52
  • Much appreciation !!
    – Sebastian
    Commented Dec 8, 2017 at 16:48

Make the opposite join.

From point join polygons than a new point shapefile will be created, each point will have the information of which polygon belongs.

A distance field will be created, if you have any point outside of polygons it will join the nearest polygon and the distance will be more than 0.

  • sorry I am afraid I dont understand. Does this provide the number of POI classes in each polygon?
    – Sebastian
    Commented Dec 8, 2017 at 14:39
  • You can use summarize and then get a count of the records for each polygon. or you could simply sort on that attribute, highlight the records that fall in that zone and get the count at the bottom, thats sometimes quickest if you only have a few polygons, otherwise summarize will be quicker.
    – ed.hank
    Commented Dec 8, 2017 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.