Select to view content in your preferred language

How to create Route Event Layer with Maps SDK for .NET?

358
0
07-19-2023 12:26 PM
Labels (4)
KevinCheriyan
Occasional Contributor

What I'm trying to solve: 

I want to calculate the distance traversed along a line feature from a point that's on the line. The line features split and contain branches (think river stream) at irregular intervals. I want to solve this problem using .NET Maps SDK in .NET MAUI, using locally stored data from an MMPK. I have a network dataset that contains this data, so I can use the Network Analysis namespace.

Our client has a python script that uses arcpy to create a route event layer from a service area layer to perform this task. The route events that get created are the point locations that I'm trying to recreate in my .NET application. 

What I have tried so far:

In this network dataset, I have point "facility" features and line "network" features. With this data, I have created ServiceAreaTask and I'm able to map ServiceAreaPolygons on the map. There is no equivalent of "Create Route Event Layer" in .NET Maps SDK, so I do a couple of things to achieve the same effect (or so I thought). First, I take the ServiceAreaPolygon, create a boundary around the polygon, and see where the line feature in question intersects with the polygon boundary. I figured that since the extent of the Service Area Polygon matches with the impedance cutoff, the boundary on the line should be where the event is.

Now, this works only ~ 50% of the time. ServiceAreaPolygons are created in what seems like, erratic and random places, in areas where there's no data. This gives me extra, incorrect point locations. In other cases, I also end up with less points than I should. Suffice it to say that what I am trying to mimic CreateRouteEventLayer does not work.

Anyone have any idea on what's really happening behind the scenes of CreateRouteEventsLayer that I can also de-construct and apply using .NET Maps SDK? I'm also looking into CreatePointAlong() method in GeometryEngine, which would work in some cases, but not all, I think. Not sure how it can handle branch-offs and splits in a polyline.

Thanks in advance!


--------------------------------------------------
Application Developer, GeoMarvel
0 Kudos
0 Replies