Locate a route event

463
5
05-13-2020 02:29 PM
MarvisKisakye1
Occasional Contributor


I am attempting to obtain the geometry of a route event using the event properties. With ArcObjects VB.Net, this is the code that was used.

Dim routeLocation As IRouteLocation2=new RouteMeasureLineLocationClass()
routeLocation.RouteID=rteID
//...Set other route properties here..//
Dim routeMeasureLineLocation As IRouteMeasureLineLocation=DirectCast(routeLocation,IRouteLocation2)
routeMeasureLineLocation.FromMeasure=fromMeasure
routeMeasureLineLocation.ToMeasure=toMeasure
Dim geometry As IGeometry=Nothing
Dim routeLocator as IRouteLocator = Me.RouteLocator()
routeLocator.Locate(routeLocation,geometry,locatingError)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

In converting the above code to Pro SDK C#, I was able to create an instance of the CIMRouteEventDataConnection class and set its properties as below:

var routeLocation = new CIMRouteEventDataConnection();
routeLocation.RouteIDFieldName = RouteFieldname;
routeLocation.RouteMeasureUnit = LinearUnit.Miles;
routeLocation.FromMeasureFieldName = fromMsField;
routeLocation.ToMeasureFieldName = ToMsField;


I, however, don't see a method for 'Locate' like in ArcObjects. So how do I actually generate the geometry that represents the line event?Uma HaranoWolfgang Kaiser

0 Kudos
5 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Marvis,

 Currently the sole purpose of the CIMRouteEventDataConnection class is to expose some properties on a 'Route Event Layer'.  However, if you take a look at the comments in this 'idea post' this might be of help to you:

https://community.esri.com/ideas/13766 

0 Kudos
RussBurman
New Contributor

Hello... I am also interested in learning about methods associated with CIMRouteEventDataConnection. We currently have an ArcMap AddIn written with original COM objects... then into VB.NET... now I am looking at building the same AddIn with ArcPro SDK .NET for use in ArcGIS PRO. Any new insights on how this may be done? maybe SDK .NET has not fully be built?  Our tool calculates a RiverMile distance from the mouth of a stream based on a Route being identified and then using associated feature Field Values of the layer being identified by the Route.  Thanks...

Tags (1)
0 Kudos
JamalWest2
Occasional Contributor

Does anybody have an actual solution for this @RussBurman @MarvisKisakye1 ?

0 Kudos
MarvisKisakye1
Occasional Contributor

I saw that the topology api was released. I mean to look through it to see if it provides some solutions but I have not yet had the time. Check it out and see if it has what you need.

0 Kudos
JamalWest2
Occasional Contributor

Well I actually figured this out today. I'm shocked honestly. I might be doing something slightly different than you guys, but I was simply trying to return the x,y of point along the route at a specific distance(measurement). 

 

 QueryFilter qF = new QueryFilter
  {
    WhereClause = "RouteNumber = '504'"      
  };
nLayer.Select(qF);
var featci = nLayer.GetSelection();
using (ArcGIS.Core.Data.RowCursor rCursor = featci.Search())
  {
    while (rCursor.MoveNext())
    {
       Feature gsFeature = rCursor.Current as Feature;
       var feat = gsFeature.GetShape();
       var efeat = feat.ToEsriShape();
       Polyline polyline = PolylineBuilder.FromEsriShape(efeat);
       double m1, m2;
       ArcGIS.Core.Geometry.Multipoint multipoint = GeometryEngine.Instance.GetPointsAtM(polyline, .4, 0);
       var mpc = multipoint.PointCount.ToString();
       System.Windows.MessageBox.Show(mpc);              
       System.Windows.MessageBox.Show(multipoint.Points[0].X.ToString());                       
       System.Windows.MessageBox.Show(multipoint.Points[0].Y.ToString());
       }
            }                  
    });

 

0 Kudos