Cut feature line between two non-touching feature points

1040
5
01-26-2021 01:49 AM
NikolajKlausen
New Contributor II

Hello,

How can I automatically cut a feature line between two non-touching points of a different feature?

Explanation : I work for a railway construction company, and it is important for us to identify track possessions. A track possession is a line of railway between two signals. I have a layer for railway lines and a layer for signals, now I am interested in automatically generating track possessions.

Example: I have tracks (red lines) and signals (green circles)

NikolajKlausen_1-1611652862051.png

I create a new feature layer with the track for which I have a track possession, in this case track 2. In addition, I create a new feature layer with 2 green circles.

NikolajKlausen_3-1611654010382.png

 

Now I want to "cut" the track, so I get a track segment between the two green circles. I don't know how to do this, so I created a new line and manually drew it on top of the track between the two green circles. Then I added a buffer ring around this new line, and end up with the following:

NikolajKlausen_4-1611654317494.png

 

I can now add the original layers to my map and I have now created 1 track possession :

 

NikolajKlausen_5-1611654377982.png

 

Is there any clever way of doing this automatically? 

 

Thank you in advance,

 

Nikolaj

 

 

0 Kudos
5 Replies
DanPatterson
MVP Esteemed Contributor

Did you try?

Split Line at Point (Data Management)—ArcGIS Pro | Documentation

If Search Radius (search_radius in Python) is unspecified, the nearest point will be used to split the line feature. If a Search Radius is specified, all points within the search radius are used to split the line.


... sort of retired...
NikolajKlausen
New Contributor II

Hey Dan,

Thank you for your reply, that seems to be a viable solution. 

I can see it requires an extension which my current license does not have. 

Is it correctly understood that the functionality of my scripts in Python also depends on my ArcGIS Pro license?

Thank you in advance

 

 

 

0 Kudos
DanPatterson
MVP Esteemed Contributor

Yes it does require an advanced license and your access to tools in python scripts would be limited to your license level.  That particular tool doesn't require an extra extension, it is part of the Data Management toolset.

You will be able to construct transect lines between two points if the signals are sequentially ordered

XY To Line (Data Management)—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos
mody_buchbinder
Occasional Contributor III

Here is a code sample that  gets point (pt) and return a snap point on a line in roadFC in a tolerance tol

 

def  returnSnapPoint(pt):
    try:
        if(pt == None): return None
        # return the point snap to closest line or None
        if(arcpy.Exists('road_lyr') == True):
            arcpy.Delete_management('road_lyr')
        arcpy.MakeFeatureLayer_management(roadFC, 'road_lyr')
        arcpy.SelectLayerByLocation_management('road_lyr', 'WITHIN_A_DISTANCE', [pt], tol)
        c = int(arcpy.GetCount_management('road_lyr')[0])
        if( c == 0): return None
        dist = 1000
        closeLine = None
        # get closest line
        with arcpy.da.SearchCursor('road_lyr', ["SHAPE@"]) as cursor:
            for row in cursor:
                if(closeLine == None): # first
                    closeLine = row[0]
                    dist = closeLine.distanceTo(pt)
                else:
                    if(closeLine.distanceTo(pt) > dist 😞 continue # not closest
                    closeLine = row[0]
                    dist = closeLine.distanceTo(pt)

        return closeLine.snapToLine(pt)

 

NikolajKlausen
New Contributor II

Thank you Mody,

I'll try it out and let you know if it works out for me.

Cheers,

Nikolaj

0 Kudos