I have a polyline layer and a layer of points that are on top of the polylines. I do not have the ArcGis advanced license so I can't use the Split Line at Point tool. Can someone help me with a standalone Python script that will split my polyline by my point layer? (By the way, I know that there is a tool like this in ET Geowizards, but I don't have the license for that so I can't make that tool into a standalone script).
[GIS] Standalone Python script to split a polyline with a point layer
arcpylayerslinepointsplitting
Best Answer
Here's a script that might do it for you. The native arcpy.Geometry class has a method called "cut" that will cut any feature using another polyline. Unfortunately, since you're using "points", we have to make "fake" lines out of these points. I essentially made a scratch polyline with the points
[(Point.X+10, Point.Y+10), (Point.X-10, Point.Y-10)]
- e.g. a diagonal line for every point to perform each cut. When you have more than one point intersecting a line, you have to re-cut the lines recursively smaller-and-smaller until they can't be cut up any further (without producing zero-length geometries).A few caveats I should mention:
Point.firstPoint
for each point, so any additional multi-points thereafter will be left out. I haven't tested the effect of cutting a multi-part line, but I assume the descendants will also stay multi-part.You just have to make the skeleton tool in the toolbox that accepts 3 parameters:
Here are some examples:
![enter image description here](https://i.stack.imgur.com/jkS47.png)
And the code:
If you get any errors, let me know.