Select to view content in your preferred language

create a graphic line of length defined by user  on the dynamic line layer

883
2
05-13-2012 10:46 AM
MuhammadWaqar_ul_islam
Occasional Contributor
I have a polyline  network represent the fiber optics network spread in the city
i want to create automatic graphic line of lenght defined by the user like 17 or 18  (in km) on a selected line (selected line lenght is 100 km) or any line i select
it will create graphic line  on the network of length defined by user
Each polyline in my network  is start from station present as a point layer
i need  C# code
0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor
So you need to travel down an existing polyline a certain distance, and find that point?
This would require a little coding and trigonometry on your part, not to mention avoiding projection distortion. My suggestion is to use data in geographic coordinates (ie project to 4326), then use the built in methods for calculating line length: http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Geometry.G...

You would have to "travel" down the line, segment by segment and adding the distance up. Ie. first create a line based on the first two vertices in the line you want to measure on:
myInputLine.Paths[0][0] and myInputLine.Paths[0][1].
Use the geodesic length method and see how far that is. Then keep adding on with the following segments (1..2, 2..3) etc until you exceed the desired length, and go one back, then calculate the fraction of the last line segment that is missing (ie if you have 1km to go from the last vertex, and the next vertex is 2km down, find the spot right in-between the two vertices, and that's your location).

Sorry I don't have the code for you, but you need to do a little bit of the work too 🙂
0 Kudos
MuhammadWaqar_ul_islam
Occasional Contributor
Required more help in coding  to start
0 Kudos