Select to view content in your preferred language

Linear Referencing , show overlapped poertion of the polyline

2247
6
09-05-2012 06:51 AM
SantoshV
Emerging Contributor
Hi,
I have done Linear Referencing using Make Route Event Layer and showing the desired result on map by filtering the attributes using the where clause and creating a featurelayer and adding it to the map
Now when I query the road

Road Start_km = 1, End_km = 10
(Attributes)
StartKM = 1, endKM = 7 WorkID = 1
StartKM = 5, endKM = 10 WorkD = 2

Here as you see the  chainage 5 to 7 is an overlap
My requirement is such that I want to highlight the overlapped portion that contains both the work ID(i.e 5 to 7)

When I query my route event layer it shows workid from 1 to 7 and the workid 2 from 7 to 10..

Please guide as to how I can achieve my results...
0 Kudos
6 Replies
DominiqueBroux
Esri Frequent Contributor
This linear referencing sample demonstrates how you can extract a polyline between two linear positions (start KM 5, end KM 7 in your example)
0 Kudos
SantoshV
Emerging Contributor
Dominique,
Thank you so much for the reply this is what I exactly was looking for ,  I have modified my code to suit my requirement, but it does not seems to work that good...
in  UpdateGraphics() method what is   if (_graphicsLayer.Graphics.Count >= 4) count 4 been checked for I tried the same but I seemed to be missing a few polyline links...
Can you please take a look take a  code for me,  I have attached the code

Please do guide me..
0 Kudos
DominiqueBroux
Esri Frequent Contributor
in UpdateGraphics() method what is if (_graphicsLayer.Graphics.Count >= 4) count 4 been checked for


That's only useful in order to know if the graphics showing the result (2 point markers, the initial line and the result line) have already been created.
It's only for the sample purpose and very likely you don't need that in your application.

You should just have to grab the LinearReferencingExtension class that offers a M1ToM2 method returning the polyline between 2 linear positions.
Something like:
   var subLine = myPolyline.M1ToM2(5000, 7000);
0 Kudos
SantoshV
Emerging Contributor
Dominique,
Yes I got it, it works fine thank you soo much
But I still have issues in some cases where
My polyline(available geometry) StartKM = 1300 and  End KM = 3100, therefore when M1 = 1300 the  subline should start from the first segment ....
My minimum M1 should be 1300 and Maximum should be 3100..

Note:My requirement is that I have to create a subline with the given start and end km, on a polyline which contains a start and end km whose start km may or may not start from zero....

Please guide me am really stuck here...
0 Kudos
DominiqueBroux
Esri Frequent Contributor
What about substracting the startKM to M1 and M2?
i.e polyline.M1ToM2(m1-1300, m2-1300);
0 Kudos
SantoshV
Emerging Contributor
Thank you so much I have managed to get it working now..
it works fine.....
0 Kudos