0

I have a point feature class which contains features scattered around the city, with some of the points intersecting other points.

These intersecting features are correctly different features (they don't represent the same record), however I'd like to get a count of intersecting features so that I can do additional processing based on whether there are multiple points at a location.

My points have Location IDs, which should match all points at that location, but I can't guarantee this. It is also possible that some of the Location IDs are in more than one location. This is because the locations originally came from polygons, so the points in the same polygon ended up with the same ID.

I've used the Summary Statistics tool to get me close to what I'm wanting, however because of the above mis-matches with location-IDs, I'd prefer to have this run on the XY of the points rather than the Location ID.

When I use the Summary Statistics tool and set the Case field to be SHAPE it doesn't give me a count of the features. If I set the Case field to be LOCATIONID it does give me a count of the features. I use OBJECTID as the Statistics field (using COUNT).

Summary Statistics using SHAPE:
enter image description here

Summary Statistics using Location ID:
enter image description here

So my question is how can I get a count of intersecting point features? I don't mind a bit of scripting to get it there, I'm just stuck as to what tool(s) to use. I've tried Find Identical, Near, Generate Near table, Summary Statistics, and only Summary Statistics seems to get me close to what I need.

1

I've put together the following using some comparisons on geometry objects as-retrieved from nested cursors. The function assumes a point feature class as input, and it also of course assumes that points with equal geometry are considered intersecting. Each result in the DUPLICATE field records the total amount of points in the feature class which share the same geometry (including the current feature). I hope this helps:

import arcpy

def get_count_of_repeat_geometry(input_point_feature_class):
    'writes a count field of geometry repeats, per-feature, to the feature class'
    arcpy.AddField_management(input_point_feature_class, 'DUPLICATE', 'SHORT')
    # The following is probably a horribly inefficient setup, SO MANY LOOPS
    with arcpy.da.UpdateCursor(input_point_feature_class, ['SHAPE@', 'DUPLICATE']) as outer_cursor:
        for outer_row in outer_cursor:
            geometry = outer_row[0]
            duplicate_count = 1
            with arcpy.da.SearchCursor(input_point_feature_class, ['SHAPE@']) as inner_cursor:
                for inner_row in inner_cursor:
                    test_geometry = inner_row[0]
                    if geometry == test_geometry:
                        duplicate_count += 1
            outer_row[1] = duplicate_count
            outer_cursor.updateRow(outer_row)
  • Hey Midavalo - I stumbled across the collect events tool today in dealing with a similar problem, I think this tool will basically resolve your need in a single step. Wish I could have found this earlier! – Jim Apr 13 '16 at 16:55
  • I've ended up with some code similar to yours, but will check out the collect events tool too – Midavalo Apr 13 '16 at 18:12
4

Here is a simple process to get count and flag interesting point features:

  1. Create new text field in point layer
  2. If the table has a x and y fields with values skip this step, otherwise run the Add XY Coordinate tool
  3. Field calculate/concatenate the x and y field values to the new text field from step one (eg. [x]&" "&[y])
  4. Use calculated field and select Summarize. This will produce a summary table of the xy coordinates essentially telling you what xy pairs are the same/overlap via the count field
  5. Join sum table by xy concat field to point table via step 1 field

Features with overlaps will have a count >1.

These listed steps may be done via the related arcpy method too (add field, add xy coordinates, calculate field, summarize, join...etc).

  • thanks I'll take a look. I'm hoping to automate so step 4 will need to be replace with something I don't need to right-click on, but sounds like we're heading in the right direction – Midavalo Apr 13 '16 at 18:13
  • Step four use either calculate field or update cursor then summary stat. – artwork21 Apr 13 '16 at 21:20
2

What about using something like the point distance tool?

http://desktop.arcgis.com/en/arcmap/10.3/tools/analysis-toolbox/point-distance.htm

You can calculate the distance between every point within a minimum radius (e.g. 1 foot), then find all the points with zero or close to zero distances? This can be matched to the FID and the LocID.

Unfortunately it is only available for advanced licenses.

  • I'll take a look at that – Midavalo Apr 13 '16 at 18:12
1

This IS the most basic operation. Create text field, populate it using

'%s %s' %(!Shape!.firstpoint.X,!Shape!.firstpoint.Y)

Use it as case to summarise field with sequential ID

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.