1

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?

  • Are you looking for a scripted approach? – Aaron Nov 10 '14 at 18:07
  • 1
    Was more looking for a tool based approach or a combination of queries that would give the correct #. As an aside, this was a question for the gis lab I TA and no one got this Q right. So im wondering if it's beyond their scope. – GISKid Nov 10 '14 at 18:10
  • 1
    Some of the things mentioned in the question sound like tool setting issues. With selections, is the method within or intersect, as these will return different results? With spatial join, what is the join operation set to? One to one would only return the point once, while one to many would count it for every polygon - and the match option, similar to selection method, comes into play here as well. Does the lab have a solution method for the problem (ie, an intended solution)? Are the answers showing up at all consistent? That can help track down what people did wrong. – Chris W Nov 11 '14 at 0:55
  • Point on boundary is frequently a problem. Sometimes the point returns as inside, sometimes it doesn't. As we would see a point on a line as people, unless the point falls exactly on a solution for the line segment equation it's mathematically not really on the line it's either one side or the other. This is where you have to decide on a tolerance to determine your solution. – Michael Stimson Nov 11 '14 at 3:47
  • There was a small enough # of points to visually check what the "correct" answer should be (3), however, if they did "count points in polygons" in QGIS it came out to 2. Or they were getting 5 (not 100% how). I guess next year this q should be scrapped. – GISKid Nov 13 '14 at 18:22
1

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.

  • I think this would be the best solution, if looking for a scripted approach - however was concerned about looking for a tool based one. I'll accept your solution in a few days if there's no other contributions. – GISKid Nov 13 '14 at 18:23
  • @GISKid, You may create your own script tool that calls the python script, see link resources.arcgis.com/en/help/main/10.2/index.html#/… – artwork21 Nov 14 '14 at 14:57
0

Intersect points and polygons (ArcGIS) - output type - point. For points exactly on the shared boundary of 2 polygons this will result in 2 points

0

Near is not your friend in this case:

  • It alters the point features by adding NEAR_FID and NEAR_DIST to their table and optionally other fields.
  • You are right, a point can only be 'near' one polygon.

What you really want is Generate Near Table with a search_radius of 0 (or at least something very small) - a point on a line mathematically is very difficult unless it's coincident with a vertex, and using closest of all.

From this you can then generate a summary using Summary Statistics with statistics field of IN_FID type COUNT and case field of NEAR_FID. This will give you the count of points Inside or On the boundary (within tolerance). Points will be counted more than once where they fall on the boundary between two polygons.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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