[GIS] How to Count point in polygon + on boundary

arcgis-10.2arcgis-desktoppoint-in-polygonqgis-2

So I'm looking for suggestions in both ArcGIS 10.2 and QGIS on methods on how to count points within a polygon and points that fall on a polygon boundary without adjusting the data/points.

The problem is, if a point is shared by two polygons (on the boundary of both), I'd like this point to be counted to be in each polygon.

I've found that select by location in Arc works as a good visual check, to examine these areas. However, if using a spatial join typically the point is only counted once, or not at all. And if there is a larger dataset visually inspecting isn't always feasible.

A quick googling around shows that you can use the Near Function, but I don't believe this would count the same point more than once in polygons that share a boundary.

Does anyone have any thoughts to improve this methodology in both ArcGIS and QGIS?

Best Answer

For ArcGIS I would suggest using a python script for this. The general code flow would go something like:

  1. Make feature layer of point layer
  2. Create count field for polygon layer
  3. Define update cursor on polygon layer
  4. Loop through each feature and use select layer by location method
  5. Use get count method to get the number of selected point features
  6. Write count value from step 5 to polygon count field to current polygon feature using update cursor

This will allow you to count points that may intersect many different polygon features per polygon.

Related Question