Sub CalibrateRoutesWithPoints() Dim ET As ETGW_Core Dim pMxDoc As IMxDocument Dim pMap As IMap Dim pInputLayer As IFeatureLayer Dim pInputFeatureClass As IFeatureClass Dim pPointFeatureLayer As IFeatureLayer Dim pPointFeatureClass As IFeatureClass Dim pOutFeatureLayer As IFeatureLayer Dim pOutFeatureClass As IFeatureClass Dim sOutFileName As String Set ET = New ETGW_Core Set pMxDoc = ThisDocument Set pMap = pMxDoc.FocusMap Set pInputLayer = ET.GetLayer("inputRoutes") If pInputLayer Is Nothing Then Exit Sub End If Set pInputFeatureClass = pInputLayer.FeatureClass If pInputFeatureClass.ShapeType <> esriGeometryPolyline Then MsgBox "Incorrect Shape type" Exit Sub End If Set pPointFeatureLayer = ET.GetLayer("inputPoints") If pPointFeatureLayer Is Nothing Then MsgBox "Layer could not be found" Exit Sub End If Set pPointFeatureClass = pPointFeatureLayer.FeatureClass sOutFileName = "c:\00\calibratedRoutes.shp" '======================================================================= Dim sMessage As String Dim dSearchTol As Double Dim pGDS As IGeoDataset Dim sIdFieldName As String Dim sPointIdFieldName As String Dim pOutSRef As ISpatialReference Dim bM As Boolean Dim sMFieldName As String Dim sCalibrateMethod As String Dim lUpdateMethod As Long Dim bIgnoreGaps As Boolean sIdFieldName = "ET_KEY" 'the field to be used as route identifier sPointIdFieldName = "RouteID" 'the field name from the point dataset that corresponds to the sIdFieldName bM = True ' the new values will be taken from PointMs sMFieldName = "" 'if bM =True this parameter is ignored sCalibrateMethod = "Distance" 'the routes will be calibrated by distance lUpdateMethod = 7 ' update method - all extrapolations and interpolations will be used bIgnoreGaps = True ' the spatial gaps will be ignored dSearchTol = 10 Set pGDS = pInputFeatureClass Set pOutSRef = pGDS.SpatialReference 'the output will have the same spatial reference as the input Set pOutFeatureClass = ET.CalibrateRoutes(pInputFeatureClass, _ pPointFeatureClass, sOutFileName, sIdFieldName, sPointIdFieldName, _ bM, sMFieldName, sCalibrateMethod, lUpdateMethod, bIgnoreGaps, _ dSearchTol, pOutSRef, sMessage) If pOutFeatureClass Is Nothing Then MsgBox sMessage, vbCritical, "Split Polylines" Exit Sub End If '======================================================================== Set pOutFeatureLayer = New FeatureLayer Set pOutFeatureLayer.FeatureClass = pOutFeatureClass pOutFeatureLayer.Name = pOutFeatureClass.AliasName pMap.AddLayer pOutFeatureLayer End Sub