4

I am looking for an easier way (if it exists) of selecting all lines that have points snapped to them but where the points are not on the end-points of the line.

My current method is to:

  1. Generate temporary end-points for all lines (Feature Vertices to Points using BOTH_ENDS option
  2. Select all points (from actual point layer) that intersect my lines
  3. Remove from selection any points that intersect my temporary end-point features
  4. Select by location any lines that intersect the remaining selected points

This seems quite long-winded to me, and as I'm having to do this process regularly I'm keen to know if there is a simpler way to do this. I will be creating a model or arcpy tool to do the above for me, but would prefer to have a quicker process to follow.

Example of requirement

I have 500+ points and 15,000+ lines, so my current process takes a while to run each time.

EDIT: My data is in a geometric network, and EVERY line end-point has a point attached as required by the network. In this situation I am trying to find all lines with specific types of points that are snapped to the lines but are not on the ends of the lines. These are not errors, so won't be flagged by network rules.

2

Edit: My opinion to the question: I do not think there is a quicker way because you have to tell the computer to ignore any points that fall on the line endpoints then select intersecting lines with the remaining points. No generic tool that I know of does that function. I think you are using the simplest solution. Perhaps I'm wrong though and that is why you came to ask.

Perhaps a topology checker will work, but its really just a half step ahead of what you're doing. I would simply model or script the process you are already using.

The topology checker needs network analyst extension in arcmap, but in QGIS you have this plugin to find points who must be covered by endpoints of a line feature. Then do a selection on the remaining points.

Your method is just as simple and doesn't require new software or an extension.

  • I'll take a look, but I have a feeling that topology checks won't work in this case because my data is in a geometric network. I will edit my question to clarify. – Midavalo Feb 12 '16 at 2:08
  • re: topology checks won't work because my data is in a geometric network - I can't find a reference for this now, but I believe you're correct that a geodatabase topology cannot exist when the features are already inside a geometric network. In which case, your current workaround may be the best option – Stephen Lead Feb 12 '16 at 4:37
2

Script based pseudocode tested 10k+ times.

  1. Go through lines and create dictionary from their end points
  2. Go through points and select ones that on the ends

GUI untested

  1. Calculte points x and y
  2. Use snap editing tool to end points of the line
  3. Calculate newx newy and compare to old
0

With the other answers indicating that there wasn't going to be a tool that would just do it for me, I decided to script it. I realised that I had the order of my steps wrong (which would have added quite a bit of time tot he process), so once I got that sorted it works quite well.

I set it up to select one of the lines and zoom to it, which enables me to make the required changes and when re-run it'll skip that line and go to the next one.

Here is the script I ended up with:

# Access current MXD, data frame, and layers
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, lineFeatures, df)[0]

# Select Interest Points
arcpy.SelectLayerByAttribute_management(pointFeatures, "NEW_SELECTION", pointSelQuery)
# Select Lines with Interest Points
arcpy.SelectLayerByLocation_management(lineFeatures, "INTERSECT", pointFeatures, "", "NEW_SELECTION", "NOT_INVERT")
# Create EndPoints for Selected Lines
arcpy.FeatureVerticesToPoints_management(lineFeatures, lineTempEndpoints, "BOTH_ENDS")
# Select Interest Points that don't intersect EndPoints
arcpy.SelectLayerByLocation_management(pointFeatures, "INTERSECT", lineTempEndpoints, "", "SUBSET_SELECTION", "INVERT")
# Select Lines that intersect above selected Interest Points
arcpy.SelectLayerByLocation_management(lineFeatures, "INTERSECT", pointFeatures, "", "NEW_SELECTION", "NOT_INVERT")
arcpy.SelectLayerByAttribute_management(pointFeatures, "CLEAR_SELECTION")
# Drop Temp EndPoints FC
arcpy.Delete_management(lineTempEndpoints)
# Get Selection-set for Lines
fidSet = arcpy.Describe(lyr).FIDSet
fidSplit = fidSet.split(";")
# Check for Selected Lines
if len(fidSet) == 0:
    arcpy.AddMessage("Nothing Selected")
else:
# Report Number of selected Lines
    arcpy.AddMessage("{} features selected".format(len(fidSplit)))
# Get first Selected Line, Reselect just the first line, and Zoom To
    fidSet1 = fidSplit[0]
    arcpy.SelectLayerByAttribute_management(lineFeatures, "NEW_SELECTION", "OBJECTID = {}".format(fidSet1))
    df.zoomToSelectedFeatures()

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.