Hi All - I'm hoping to convert an existing ArcMap Add-in to an ArcGIS Pro Add-in but the tool does quite a bit of Linear Referencing and I can't seem to find an equivalent of the below code, or any other tasks from the linear referencing portion of the tool. The ArcMap tool allows the user to trace an LRS to define a "project segment" then that segment is located on the LRS and the measures stored in an event table for future use.
Any ideas would be great as I haven't been able to find anything dealing with LRS methods. Maybe they're just not available yet?
public static void LRSLocateLine(IFeatureClass InputFC)
{
try
{
IRouteLocator rtLocator = LRSSetupLocator();
//create new table name for output to scratch workspace
IDataset ds = (IDataset)createWSandFC.fWorkspace;
IWorkspaceName wsn = (IWorkspaceName)ds.FullName;
ITableName tblname = new TableNameClass();
IDatasetName dsn = (IDatasetName)tblname;
dsn.WorkspaceName = wsn;
dsn.Name = "events_temp";
try
{
IDataset tempDS;
tempDS = (IDataset)createWSandFC.fWorkspace.OpenTable("events_temp");
tempDS.Delete();
}
catch
{
}
//Create RouteLocatorOperations object
IRouteLocatorOperations2 routeop = new RouteLocatorOperationsClass();
routeop.RouteLocator = rtLocator;
routeop.InputFeatureClass = InputFC;
//output event properties
IRouteEventProperties2 LMeasProps = new RouteMeasureLinePropertiesClass(); //RouteMeasurePointPropertiesClass();
LMeasProps.AddErrorField = true;
LMeasProps.EventRouteIDFieldName = "RTE_NM";
IRouteMeasureLineProperties MPLineProps = (IRouteMeasureLineProperties)LMeasProps;
MPLineProps.FromMeasureFieldName = "FromMeas";
MPLineProps.ToMeasureFieldName = "ToMeas";
//Locate the points along the routes
double radius = 1;
routeop.LocateLineFeatures(radius, LMeasProps, true, dsn, "DEFAULT", null);
}
catch (System.Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
}
}