<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Kilometer Intelligence on a Railway Polyline in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657072#M99473</link>
    <description>&lt;P&gt;You want to look at the Create Routes tool.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/3.4/tool-reference/linear-referencing/create-routes.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/3.4/tool-reference/linear-referencing/create-routes.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;See the help on Linear Referencing.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/linear-referencing/introduction-to-linear-referencing.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/help/data/linear-referencing/introduction-to-linear-referencing.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Oct 2025 12:40:53 GMT</pubDate>
    <dc:creator>BobBooth1</dc:creator>
    <dc:date>2025-10-10T12:40:53Z</dc:date>
    <item>
      <title>Kilometer Intelligence on a Railway Polyline</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657031#M99471</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I’ve been trying—so far without success—to add some intelligence to a polyline in ArcGIS. I have a polyline representing a railway line, with an attribute field that stores the line’s starting kilometer point. I also have a point layer with kilometer markers placed every 1,000 meters along the railway. I want to transfer this information onto the polyline so that, no matter where I click on the line, I can retrieve the exact kilometer value at that location—like in the screenshot.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot_KP.png" style="width: 532px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141776i16B9C023C68BC300/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot_KP.png" alt="Screenshot_KP.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Does someone has an idea how to proceed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance and best regards&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;</description>
      <pubDate>Fri, 10 Oct 2025 09:17:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657031#M99471</guid>
      <dc:creator>offi24</dc:creator>
      <dc:date>2025-10-10T09:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Kilometer Intelligence on a Railway Polyline</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657057#M99472</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/833115"&gt;@offi24&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Given the complexity of your question, the only things that I can recommend are as follows:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Create a copy of the polyline and edit the copied line by dividing it into equal distances or parts&lt;/LI&gt;&lt;LI&gt;Use/Create an attribute rule or arcade calculation to create points in another feature at set distances and then label those features.&lt;/LI&gt;&lt;LI&gt;Add fields for starting kilometer distances and label them so that the labels are positioned along the line at set distances.&lt;/LI&gt;&lt;LI&gt;Try linear referencing and seeing what tools may work best for you.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Despite those I don't think you will be able to click anywhere on a line and get the distance along that line unless you use linear referencing.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Oct 2025 11:53:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657057#M99472</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-10-10T11:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Kilometer Intelligence on a Railway Polyline</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657072#M99473</link>
      <description>&lt;P&gt;You want to look at the Create Routes tool.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/3.4/tool-reference/linear-referencing/create-routes.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/3.4/tool-reference/linear-referencing/create-routes.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;See the help on Linear Referencing.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/linear-referencing/introduction-to-linear-referencing.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/help/data/linear-referencing/introduction-to-linear-referencing.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Oct 2025 12:40:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657072#M99473</guid>
      <dc:creator>BobBooth1</dc:creator>
      <dc:date>2025-10-10T12:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Kilometer Intelligence on a Railway Polyline</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657094#M99474</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/833115"&gt;@offi24&lt;/a&gt;&amp;nbsp;Thanks for the notes along with screenshot - helps in understanding the use case.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The workflow is better handled through&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/linear-referencing/introduction-to-linear-referencing.htm" target="_self" rel="nofollow noopener noreferrer"&gt;Linear Referencing&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(simple functions) and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/production/roads-highways/what-is-roads-and-highways.htm" target="_self" rel="nofollow noopener noreferrer"&gt;Roads and Highways&lt;/A&gt;&amp;nbsp; (advanced functions).&lt;/P&gt;&lt;P&gt;You can get started with the following references:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/linear-referencing/linear-referencing-datasets.htm" target="_self" rel="nofollow noopener noreferrer"&gt;Linear referencing datasets&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;Railway lines may be&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/linear-referencing/introduction-to-routes-and-route-feature-classes.htm" target="_self" rel="nofollow noopener noreferrer"&gt;modelled as Routes&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;with the Start/End locations as Calibration Points or simply&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/linear-referencing/update-route-measures.htm" target="_self" rel="nofollow noopener noreferrer"&gt;update measures on the vertices&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;You can retrieve the measure value using the&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/mapping/navigation/pop-ups.htm#ESRI_SECTION1_C8F681B618564E888D693C8E7DA3BCC2" target="_blank" rel="noopener nofollow noreferrer"&gt;Explore/Identify tool&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-pro/transportation/how-to-choose-between-linear-referencing-and-location-referencing/" target="_self" rel="nofollow noopener noreferrer"&gt;How to choose between linear referencing and location referencing&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The use case is discussed in the following posts:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-roads-and-highways-questions/creating-points-at-hatch-intervals-along-lrs/m-p/1243510" target="_blank" rel="noopener"&gt;Creating points at hatch intervals along LRS routes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/create-line-segments-from-point-locations/td-p/1240162" target="_blank" rel="noopener"&gt;Create Line segments from Point Locations referencing Linear feature&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Oct 2025 13:21:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657094#M99474</guid>
      <dc:creator>AyanPalit</dc:creator>
      <dc:date>2025-10-10T13:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Kilometer Intelligence on a Railway Polyline</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657598#M99517</link>
      <description>&lt;P&gt;我最近在学习add-in的开发，也许我可以做一个小插件实现这个功能，&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 06:48:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657598#M99517</guid>
      <dc:creator>guanjiu</dc:creator>
      <dc:date>2025-10-14T06:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Kilometer Intelligence on a Railway Polyline</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657612#M99519</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I can't publish my tool here, so I can only share the code. It can identify line features and automatically provide the distance from the initial point to the area where the mouse hovers (when the mouse hovers over the line for 3 seconds).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 08:43:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657612#M99519</guid>
      <dc:creator>guanjiu</dc:creator>
      <dc:date>2025-10-14T08:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: Kilometer Intelligence on a Railway Polyline</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657613#M99520</link>
      <description>&lt;P&gt;using ArcGIS.Core.CIM;&lt;BR /&gt;using ArcGIS.Core.Data;&lt;BR /&gt;using ArcGIS.Core.Geometry;&lt;BR /&gt;using ArcGIS.Core.Internal.Geometry;&lt;BR /&gt;using ArcGIS.Desktop.Framework.Threading.Tasks;&lt;BR /&gt;using ArcGIS.Desktop.Mapping;&lt;BR /&gt;using System;&lt;BR /&gt;using System.Collections.Generic;&lt;BR /&gt;using System.Linq;&lt;BR /&gt;using System.Threading;&lt;BR /&gt;using System.Threading.Tasks;&lt;BR /&gt;using System.Windows.Input;&lt;/P&gt;&lt;P&gt;namespace PolylineDistanceTool&lt;BR /&gt;{&lt;BR /&gt;internal class ShowDistanceTool : MapTool&lt;BR /&gt;{&lt;BR /&gt;private IDisposable _graphic = null;&lt;BR /&gt;private Timer _hoverTimer;&lt;BR /&gt;private MapPoint _lastMousePosition = null;&lt;BR /&gt;private readonly object _timerLock = new object();&lt;BR /&gt;private const int HoverDelay = 3000;&lt;/P&gt;&lt;P&gt;public ShowDistanceTool()&lt;BR /&gt;{&lt;BR /&gt;IsSketchTool = false;&lt;BR /&gt;Cursor = Cursors.Cross;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;protected override Task OnToolDeactivateAsync(bool haskwargs)&lt;BR /&gt;{&lt;BR /&gt;ClearOverlay();&lt;BR /&gt;StopHoverTimer();&lt;BR /&gt;return base.OnToolDeactivateAsync(haskwargs);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;protected override void OnToolMouseMove(MapViewMouseEventArgs e)&lt;BR /&gt;{&lt;BR /&gt;if (e.LeftButton == MouseButtonState.Pressed)&lt;BR /&gt;{&lt;BR /&gt;ClearOverlay();&lt;BR /&gt;StopHoverTimer();&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Task.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;_lastMousePosition = MapView.Active?.ClientToMap(e.ClientPoint);&lt;BR /&gt;ResetHoverTimer();&lt;BR /&gt;});&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;private void ResetHoverTimer()&lt;BR /&gt;{&lt;BR /&gt;StopHoverTimer();&lt;BR /&gt;_hoverTimer = new Timer(OnTimerElapsed, null, HoverDelay, Timeout.Infinite);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;private void StopHoverTimer()&lt;BR /&gt;{&lt;BR /&gt;lock (_timerLock)&lt;BR /&gt;{&lt;BR /&gt;_hoverTimer?.Dispose();&lt;BR /&gt;_hoverTimer = null;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;private void OnTimerElapsed(object state)&lt;BR /&gt;{&lt;BR /&gt;lock (_timerLock)&lt;BR /&gt;{&lt;BR /&gt;if (_hoverTimer == null) return;&lt;BR /&gt;StopHoverTimer();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;QueuedTask.Run(() =&amp;gt; PerformHitTestAndCalculateDistance(_lastMousePosition));&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;private async Task PerformHitTestAndCalculateDistance(MapPoint currentMapPoint)&lt;BR /&gt;{&lt;BR /&gt;if (currentMapPoint == null || MapView.Active == null) return;&lt;/P&gt;&lt;P&gt;ClearOverlay();&lt;/P&gt;&lt;P&gt;var point1_screen = new System.Windows.Point(0, 0);&lt;BR /&gt;var point2_screen = new System.Windows.Point(10, 0);&lt;BR /&gt;var point1_map = MapView.Active.ClientToMap(point1_screen);&lt;BR /&gt;var point2_map = MapView.Active.ClientToMap(point2_screen);&lt;BR /&gt;var searchTolerance = GeometryEngine.Instance.Distance(point1_map, point2_map);&lt;/P&gt;&lt;P&gt;if (searchTolerance &amp;lt;= 0)&lt;BR /&gt;{&lt;BR /&gt;searchTolerance = MapView.Active.Extent.Width / 1000;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var envelopeBuilder = new EnvelopeBuilder(currentMapPoint.Extent);&lt;BR /&gt;envelopeBuilder.Expand(searchTolerance, searchTolerance, false);&lt;BR /&gt;var searchEnvelope = envelopeBuilder.ToGeometry();&lt;/P&gt;&lt;P&gt;var polylineLayers = MapView.Active.Map.GetLayersAsFlattenedList()&lt;BR /&gt;.OfType&amp;lt;FeatureLayer&amp;gt;()&lt;BR /&gt;.Where(l =&amp;gt; l.ShapeType == esriGeometryType.esriGeometryPolyline &amp;amp;&amp;amp; l.IsVisible);&lt;/P&gt;&lt;P&gt;foreach (var layer in polylineLayers)&lt;BR /&gt;{&lt;BR /&gt;var spatialQueryFilter = new SpatialQueryFilter&lt;BR /&gt;{&lt;BR /&gt;FilterGeometry = searchEnvelope,&lt;BR /&gt;SpatialRelationship = SpatialRelationship.Intersects&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;using (var selection = layer.Select(spatialQueryFilter))&lt;BR /&gt;{&lt;BR /&gt;if (selection.GetCount() == 0)&lt;BR /&gt;continue;&lt;/P&gt;&lt;P&gt;using (var cursor = selection.Search(null, false))&lt;BR /&gt;{&lt;BR /&gt;if (cursor.MoveNext())&lt;BR /&gt;{&lt;BR /&gt;using (var feature = cursor.Current as Feature)&lt;BR /&gt;{&lt;BR /&gt;if (feature?.GetShape() is Polyline polyline)&lt;BR /&gt;{&lt;BR /&gt;// **==================== 最终修正于此 ====================**&lt;BR /&gt;// 步骤 1: 获取鼠标点在折线上的最近点&lt;BR /&gt;var nearestPointResult = GeometryEngine.Instance.NearestPoint(polyline, currentMapPoint);&lt;BR /&gt;var pointOnLine = nearestPointResult.Point;&lt;/P&gt;&lt;P&gt;// 步骤 2: 定位该点所在的线段，并找到该线段的起始顶点索引&lt;BR /&gt;var nearestVertexResult = GeometryEngine.Instance.NearestVertex(polyline, pointOnLine);&lt;BR /&gt;int startingVertexIndexOfSegment = (int)nearestVertexResult.PointIndex;&lt;/P&gt;&lt;P&gt;// 步骤 3: 构建一个新的点集合，用于创建部分折线&lt;BR /&gt;var partialPoints = new List&amp;lt;MapPoint&amp;gt;();&lt;BR /&gt;var originalPoints = polyline.Points;&lt;/P&gt;&lt;P&gt;// 添加从起点到目标线段起始点的所有顶点&lt;BR /&gt;for (int i = 0; i &amp;lt;= startingVertexIndexOfSegment; i++)&lt;BR /&gt;{&lt;BR /&gt;partialPoints.Add(originalPoints[i]);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// 最后，添加我们计算出的精确点&lt;BR /&gt;partialPoints.Add(pointOnLine);&lt;/P&gt;&lt;P&gt;// 步骤 4: 从这个点集合创建新的折线，并获取其长度&lt;BR /&gt;var partialPolyline = PolylineBuilderEx.CreatePolyline(partialPoints, polyline.SpatialReference);&lt;BR /&gt;double distanceAlongCurve = partialPolyline.Length;&lt;BR /&gt;// **=======================================================**&lt;/P&gt;&lt;P&gt;double distanceInKm = distanceAlongCurve / 1000.0;&lt;BR /&gt;string displayText = $"距离起点: {distanceInKm:F2} 公里";&lt;/P&gt;&lt;P&gt;ShowDistanceAsOverlay(currentMapPoint, displayText);&lt;BR /&gt;return;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;private void ShowDistanceAsOverlay(MapPoint location, string text)&lt;BR /&gt;{&lt;BR /&gt;QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;CIMTextSymbol textSymbol = SymbolFactory.Instance.ConstructTextSymbol(&lt;BR /&gt;ColorFactory.Instance.BlackRGB, 12, "Arial", "Regular");&lt;/P&gt;&lt;P&gt;// 正确地创建光晕符号&lt;BR /&gt;var haloPolygonSymbol = new CIMPolygonSymbol();&lt;BR /&gt;var haloFill = new CIMSolidFill { Color = ColorFactory.Instance.WhiteRGB };&lt;BR /&gt;haloPolygonSymbol.SymbolLayers = new CIMSymbolLayer[] { haloFill };&lt;BR /&gt;textSymbol.HaloSymbol = haloPolygonSymbol;&lt;BR /&gt;textSymbol.HaloSize = 2;&lt;/P&gt;&lt;P&gt;var textGraphic = new CIMTextGraphic&lt;BR /&gt;{&lt;BR /&gt;Text = text,&lt;BR /&gt;Symbol = textSymbol.MakeSymbolReference(),&lt;BR /&gt;Shape = location&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;_graphic = MapView.Active.AddOverlay(textGraphic);&lt;BR /&gt;});&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;private void ClearOverlay()&lt;BR /&gt;{&lt;BR /&gt;if (_graphic != null)&lt;BR /&gt;{&lt;BR /&gt;_graphic.Dispose();&lt;BR /&gt;_graphic = null;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 08:44:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/kilometer-intelligence-on-a-railway-polyline/m-p/1657613#M99520</guid>
      <dc:creator>guanjiu</dc:creator>
      <dc:date>2025-10-14T08:44:51Z</dc:date>
    </item>
  </channel>
</rss>

