<?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 How to connect certain points into a polylines? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-connect-certain-points-into-a-polylines/m-p/1103887#M46228</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a question for you. How do I connect certain points to form a polylines?(point one with another, third with fourth, etc.)&lt;/P&gt;&lt;P&gt;The code I have thus forms a polyline from the first to the first point, from the first to the second, from the first to the third, etc.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;private Task&amp;lt;bool&amp;gt; ConstructSamplePolylines()&lt;BR /&gt;{&lt;BR /&gt;var polylineLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;()&lt;BR /&gt;.FirstOrDefault(f =&amp;gt; f.ShapeType == esriGeometryType.esriGeometryPolyline);&lt;BR /&gt;var pointLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;()&lt;BR /&gt;.FirstOrDefault(f =&amp;gt; f.ShapeType == esriGeometryType.esriGeometryPoint);&lt;BR /&gt;// execute the fine grained API calls on the CIM main thread&lt;BR /&gt;return QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;// get the underlying feature class for each layer&lt;BR /&gt;var polylineFeatureClass = polylineLayer.GetTable() as FeatureClass;&lt;BR /&gt;var pointFeatureClass = pointLayer.GetTable() as FeatureClass;&lt;/P&gt;&lt;P&gt;// retrieve the feature class schema information for the feature classes&lt;BR /&gt;var polylineDefinition = polylineFeatureClass.GetDefinition();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// construct a cursor for all point features, since we want all feature there is no&lt;BR /&gt;// QueryFilter required&lt;BR /&gt;var pointCursor = pointFeatureClass.Search(null, false);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// initialize a counter variable&lt;BR /&gt;int pointCounter = 0;&lt;BR /&gt;// initialize a list to hold 5 coordinates that are used as vertices for the polyline&lt;BR /&gt;var lineMapPoints = new List&amp;lt;MapPoint&amp;gt;();&lt;/P&gt;&lt;P&gt;// set up the edit operation for the feature creation&lt;BR /&gt;var createOperation = new EditOperation()&lt;BR /&gt;{&lt;BR /&gt;Name = "Tvorba Linií",&lt;BR /&gt;SelectNewFeatures = false&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;// loop through the point features&lt;BR /&gt;while (pointCursor.MoveNext())&lt;BR /&gt;{&lt;BR /&gt;pointCounter++;&lt;/P&gt;&lt;P&gt;var pointFeature = pointCursor.Current as Feature;&lt;BR /&gt;// add the feature point geometry as a coordinate into the vertex list of the line&lt;BR /&gt;// - ensure that the projection of the point geometry is converted to match the spatial reference of the line&lt;BR /&gt;lineMapPoints.Add(((MapPoint)GeometryEngine.Instance.Project(pointFeature.GetShape(), polylineDefinition.GetSpatialReference())));&lt;BR /&gt;var newPolyline = PolylineBuilder.CreatePolyline(lineMapPoints, polylineDefinition.GetSpatialReference());&lt;BR /&gt;// queue the create operation as part of the edit operation&lt;BR /&gt;createOperation.Create(polylineLayer, newPolyline);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// execute the edit (create) operation&lt;BR /&gt;return createOperation.ExecuteAsync();&lt;BR /&gt;});&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Fri, 01 Oct 2021 10:48:56 GMT</pubDate>
    <dc:creator>DavidMrázek</dc:creator>
    <dc:date>2021-10-01T10:48:56Z</dc:date>
    <item>
      <title>How to connect certain points into a polylines?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-connect-certain-points-into-a-polylines/m-p/1103887#M46228</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a question for you. How do I connect certain points to form a polylines?(point one with another, third with fourth, etc.)&lt;/P&gt;&lt;P&gt;The code I have thus forms a polyline from the first to the first point, from the first to the second, from the first to the third, etc.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;private Task&amp;lt;bool&amp;gt; ConstructSamplePolylines()&lt;BR /&gt;{&lt;BR /&gt;var polylineLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;()&lt;BR /&gt;.FirstOrDefault(f =&amp;gt; f.ShapeType == esriGeometryType.esriGeometryPolyline);&lt;BR /&gt;var pointLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;()&lt;BR /&gt;.FirstOrDefault(f =&amp;gt; f.ShapeType == esriGeometryType.esriGeometryPoint);&lt;BR /&gt;// execute the fine grained API calls on the CIM main thread&lt;BR /&gt;return QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;// get the underlying feature class for each layer&lt;BR /&gt;var polylineFeatureClass = polylineLayer.GetTable() as FeatureClass;&lt;BR /&gt;var pointFeatureClass = pointLayer.GetTable() as FeatureClass;&lt;/P&gt;&lt;P&gt;// retrieve the feature class schema information for the feature classes&lt;BR /&gt;var polylineDefinition = polylineFeatureClass.GetDefinition();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// construct a cursor for all point features, since we want all feature there is no&lt;BR /&gt;// QueryFilter required&lt;BR /&gt;var pointCursor = pointFeatureClass.Search(null, false);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// initialize a counter variable&lt;BR /&gt;int pointCounter = 0;&lt;BR /&gt;// initialize a list to hold 5 coordinates that are used as vertices for the polyline&lt;BR /&gt;var lineMapPoints = new List&amp;lt;MapPoint&amp;gt;();&lt;/P&gt;&lt;P&gt;// set up the edit operation for the feature creation&lt;BR /&gt;var createOperation = new EditOperation()&lt;BR /&gt;{&lt;BR /&gt;Name = "Tvorba Linií",&lt;BR /&gt;SelectNewFeatures = false&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;// loop through the point features&lt;BR /&gt;while (pointCursor.MoveNext())&lt;BR /&gt;{&lt;BR /&gt;pointCounter++;&lt;/P&gt;&lt;P&gt;var pointFeature = pointCursor.Current as Feature;&lt;BR /&gt;// add the feature point geometry as a coordinate into the vertex list of the line&lt;BR /&gt;// - ensure that the projection of the point geometry is converted to match the spatial reference of the line&lt;BR /&gt;lineMapPoints.Add(((MapPoint)GeometryEngine.Instance.Project(pointFeature.GetShape(), polylineDefinition.GetSpatialReference())));&lt;BR /&gt;var newPolyline = PolylineBuilder.CreatePolyline(lineMapPoints, polylineDefinition.GetSpatialReference());&lt;BR /&gt;// queue the create operation as part of the edit operation&lt;BR /&gt;createOperation.Create(polylineLayer, newPolyline);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// execute the edit (create) operation&lt;BR /&gt;return createOperation.ExecuteAsync();&lt;BR /&gt;});&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 01 Oct 2021 10:48:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-connect-certain-points-into-a-polylines/m-p/1103887#M46228</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2021-10-01T10:48:56Z</dc:date>
    </item>
  </channel>
</rss>

