Title: SplitLinesAtPoints Version:
1.2
Provided by: ESRI-TeamWater as an un
Purpose:
Splits visible, editable line features at selected point features.
Uses:
Can be used to split water mains at valves.
Can
be use to split any visible, editable line(s) as long as the point(s) is (are)
snapped to the line(s).
Split
lines at selected points or automatically split a line as a specified point
feature is created.
Files:
ReadMe_SplitLinesAtPoints.htm
SplitLinesAtPoints.bas
Modifications:
1.2– added progress bar with cancel
button (Note that cancel does not rollback edits made thus far. Undo edit after cancel if rollback is
desired.)
Data requirements:
Overview of setup (detailed instructions follow this
overview):
1)
Use VBA (provided with ArcMap) to import the code file provided with
this sample.
2)
Optionally, copy and paste editor events code into a ThisDocument
window to enable auto split as a feature is created.
3)
Save your mxd (if you did not elect to save these
changes to normal)
Setup:
In ArcMap
Tools>Macros>VB
Editor
In VB Editor
In the Project Window…
Click
Project to store changes for this map document only or
Click
File>Import
File...
Navigate to SplitLinesAtPoints.bas
and click Open
Expand
the Modules folder
Double-click the SplitLinesAtPoints
module to view the code – no changes are required
Optionally…. (for automatic split
when you create a point feature)…
Expand the ArcObjects Folder
Double-click the ThisDocument module to view the code
Note if your ThisDocument
module is empty, you may copy and paste the editor events code…
In a separate window (WordPad or NotePad), open the
ThisDocument_EditorEvents_SplitLinesAtPoints_Example.rtf
Select all of code and
click Copy
Back in the VB Editor
Click
in the ThisDocument Module and Paste the code
If
you do have some code in your ThisDocument module,
you’ll need be careful not to overwrite any existing
Editor Events code.
Read
the On_Create procedure and modify if needed to fit
your data.
Finally…
Close
VB Window
If
you chose to save your changes with this Project, save your map document now.
User configuration:
At the top of the
code, note the tolerance setting.
This value needs to
be larger than the XY Tolerance of your data but not so large that the wrong
features are split.
So for data in
decimal degrees it will be a very small value (for example .00005) but for data
in feet or meters you might use value of 1 or 2.
The default is set
very small now. If no features are split
when you run the routine and you are certain that your points are snapped to
the lines, try increasing the tolerance.
To use:
In ArcMap, be sure you have the necessary
layers in your map.
Be sure that you are editing.
Select some points. It is OK to select point
in several layers at once.
Tools>Macros>Macros…
Select SplitLinesAtPoints.SplitAtSelectedPoints
Click Run
If you have setup the
editor events in ThisDocument, be sure to run InitEvents before testing the SplitLinesAtPoints
on create functionality. If you have
pasted all of the code, when you open your map document InitEvents
will automatically run.
Here's what happens...
Any visible, editable line features
intersecting with selected points are split.
Credits:
This code was created by ESRI-Charlotte technical staff.
Your Input:
Please send any
comments via email to