www.esri.com ArcUser Winter 2010 57 Hands On “Under Construction: Building and Calculat- ing Turn Radii” showed how to calculate turns or curve radii for a steep, winding road. The tu- torial used predefined tangent points to create turn chords and to split a road centerline. This exercise will reinforce the turn chord construc- tion technique taught in that article and teach endpoint modeling. It uses a Visual Basic (VB) script that splits all constructed curves in just one run. This tutorial includes five tasks: Task 1: After creating turn chords, add fields to store coordinates of start and endpoints. Task 2: Calculate coordinates of start and endpoints. Task 3: Load all endpoints as event themes. Task 4: Run the Visual Basic script to the split road centerline at turn chord endpoints. Task 5: Assign turn numbers and join turn chord and middle ordinate lengths, then cal- culate turn radii. Getting Started Download the splittinglines.zip training set from ArcUser Online. Extract the data into a project folder and preview it in ArcCatalog. This exer- cise uses the original road centerline and con- structs turn chords and middle ordinates. Hint: When building chords from scratch, be sure to snap to road centerline vertices. To begin, start ArcMap and open \Chuckanut2\Chuckanut2.mxd. Navigate to \Chuckanut2\SHPFiles\WASP83NFH and add the Turn Chords layer. Open and inspect its table. We will use chord endpoint coordinates to create our splitting points. Task 1: Add Endpoint Coordinate Fields First, create four new fields to store X and Y coordinates for both endpoints. These points will be stored in Washington State Plane North American Datum of 1983 (NAD 83) High Accuracy Reference Network (HARN) North in U.S. Feet. 1. Open the Turn Chords table and review its structure. 2. Open Options and select Add Field. Name the field Start_X, set its Type to Double, and set its precision to 14 and its scale to 4. What You Will Need • ArcGIS Desktop (ArcView, ArcEditor, or ArcInfo license) • Sample data (splittinglines.zip) for this exercise from ArcUser Online Road Repairs Because this point must be on or very near the target line, the extra precision should help. 3. Add three more fields named Start_Y, End_X, and End_Y. Use the same data type, precision, and scale for all fields. Task 2: Calculate and Copy Endpoint Coordinates How to calculate the endpoint coordinates. 1. Begin by right-clicking on the Start_X field on its table header and select Calculate Ge- ometry. Set Property to X Coordinate of Line Start. Use the data frame’s coordinate system and set units to Feet U.S. [ft]. Click OK to calculate coordinates. 2. Continue to calculate coordinates for Start_Y, End_X, and End_Y using the same procedure. Select the correct property for each field (e.g., End_X for the End_X field), and if the wrong property is selected, just recalculate the field. 3. Navigate to the select \Chuckanut2\ SHPFiles\WASP83NFH and copy Chord1. dbf to the clipboard. Navigate to \Chuckanut2\DBFFiles and paste Chord1. dbf in this folder. Right-click on the file and rename it Chord1_XY.dbf. 4. Add Chord1_XY.dbf back to the ArcMap document and switch to the table of con- tents (TOC) Source tab. Save the project. Task 3: Load Endpoints as Event Themes 1. In the Source tab, open and inspect Chords1_XY. Right-click on this table in the TOC and choose Display XY Data. Enter X_Start for the XField and Y_Start for the YField to define the Event Theme. Import the coordinate system from Chords1.shp. Rename this layer StartPoints. 2. Right-click on Chords1_XY again, and again choose Display XY Data. Enter X_End for the XField and Y_End for the Yfield. Import the coordinate system from Chords1.shp. Rename this layer EndPoints. 3. Carefully inspect the points to verify that they are very close to the actual end- points of each chord. Zoom to Bookmark CR MP 0.0 1:3,000. Save the project. Task 4: Load and Run the Line Splitting Script A Visual Basic script that uses points to split line segments will be used to split the Chucka- nut Ridge Road centerline. The script and supporting information are available in the \Chuckanut2\Utility\ folder. 1. It is important to remove Turn Chords from the project so the only polyline theme is Chuckanut Ridge Road. 2. In the ArcMap standard menu, choose Tools > Macros > select Visual Basic Edi- tor to open an empty VB scripting window. 3. After the VB Editor opens in its own win- dow, locate the Project window and notice the Normal and Project selections. Select ing Normal will store changes for all maps accessed on this computer. Selecting Pro- ject will store changes only for this map document. For this model, select and expand Project. 4. In the VB Editor standard menu, choose the File > Import File. Nav- igate to \Chuckanut2\Utility, locate Create four new fields to store X and Y coordinates for both endpoints. By Mike Price, Entrada/San Juan, Inc. Continued on page 58 Splitting polylines with visual basic scripting Before working this exercise, you should complete “Under Construction: Building and Calculating Turn Radii,” which starts on page 50 of this issue of ArcUser, so you will understand how to calculate turn radii.