﻿
 Initialization:Function: Environment Set the number of line segments to n = 100 Ensure the map view has data layers Retrieve the view and the number of data layers Ensure exactly two data layers are active Function: Map Units Exit if there are no Map Units Retrieve Map Units If Distance Units are set, then convert to Map Units Retrieve the projection Retrieve the two themes, their associated attribute tables, and the number of features in each theme Ensure both data layers are polyline data layers Main Algorithm Function: Set Up Attribute Tables Find and define field names in both existing attribute tables (the FTab1 and the FTab2)Create a attribute table for SegmentID and RMSE Define field names in the new attribute table Predefine shapes (theShape1 and theShape2)Function: Compute RMSE Iterate through each line segment in the reference theme’s attribute table and:Retrieve SegmentID in the reference theme and create a record in the new attribute table Find the feature/record with same SegmentID in the sample theme If a matching segment is found, calculate RMSE and add it to the new attribute table, as follows:Iterate to get n segments and n + 1 points on reference polyline, determine distance to other polyline:For each Percent in 0 to 100 in steps of 100/n” [Runs from end of polyline to start]Get X, Y for a point on polyline 1 that is Percent from the polyline’s start:Create a new point using the Make method Avenue syntax: aPoint = Point.Make(X1,Y1)Get the distance (d) to the nearest point on the other polyline:Calculate the sum of the square of the distances:SumOfSqrs = SumOfSqrs + d^2 [changed units/scale to prevent “infinity”]Calculate the Root-Mean-Square-Error: RMSE = (SumOfSqrs/(n + 1))^0.5 Set RMSE field value in new attribute table If matching segment is not found, then:Put a null value (−9999.99) in the RMSE field value in the attribute table