<?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: How to extract polyline vertices from IFeature ? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-extract-polyline-vertices-from-ifeature/m-p/630965#M17024</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Owen and Todd for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Oct 2014 12:51:49 GMT</pubDate>
    <dc:creator>MarceloLago</dc:creator>
    <dc:date>2014-10-22T12:51:49Z</dc:date>
    <item>
      <title>How to extract polyline vertices from IFeature ?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-extract-polyline-vertices-from-ifeature/m-p/630961#M17020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to get to the vertices coordinates of a polylines feature layer in C#.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can get each "IFeature" object in the feature layer (in a similar way as can be done for points feature layers &lt;A href="https://community.esri.com/thread/83269"&gt;Getting raster cell indexes from point coordinates&lt;/A&gt;), but I do not know how to get the polyline vertices from there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #2b91af; font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2014 20:59:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-extract-polyline-vertices-from-ifeature/m-p/630961#M17020</guid>
      <dc:creator>MarceloLago</dc:creator>
      <dc:date>2014-10-15T20:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract polyline vertices from IFeature ?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-extract-polyline-vertices-from-ifeature/m-p/630962#M17021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For a polyline feature class each shape can be cast to &lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/IPointCollection5_Interface/002m0000027s000000/"&gt;IPointCollection&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can then iterate through each point in the point collection using &lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/EnumVertices_Property/002m00000283000000/"&gt;EnumVertices&lt;/A&gt; to access the vertices. Alternatively, you can access each point using the &lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Point_Property/002m00000286000000/"&gt;IPointCollection.Point&lt;/A&gt; property and the &lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/PointCount_Property/002m00000287000000/"&gt;PointCount&lt;/A&gt;. Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14134142522988038 jive_text_macro" jivemacro_uid="_14134142522988038"&gt;
&lt;P&gt;for (int i = 0; i &amp;lt; pointCollection.PointCount - 1 ; i++)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // access the point from the pointCollection here&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that the first Point in the PointCollection has index 0, and the last Point has index equal to PointCount - 1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, the &lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Shape_Property/002500000330000000/"&gt;Feature.Shape&lt;/A&gt; property is an IGeometry. You can use &lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/GeometryType_Property/002m0000020m000000/"&gt;IGeometry.GeometryType&lt;/A&gt; to ensure that the shape is a Polyline before accessing the vertices.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have a full code example but have done similar things in VB.Net/ArcObjects previously.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2014 23:03:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-extract-polyline-vertices-from-ifeature/m-p/630962#M17021</guid>
      <dc:creator>OwenEarley</dc:creator>
      <dc:date>2014-10-15T23:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract polyline vertices from IFeature ?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-extract-polyline-vertices-from-ifeature/m-p/630963#M17022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Owen, but when I try to cast "&lt;SPAN&gt;IPointCollection&lt;/SPAN&gt;" on "&lt;SPAN&gt;IFeature&lt;/SPAN&gt;" I get an exception. I have tried to cast without success other objects on "IFeature", such as&amp;nbsp; "IPolylineArray" and "IPolyline". Please let me know if you find a way to get an "IPointCollection" from an "IFeature".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 11:44:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-extract-polyline-vertices-from-ifeature/m-p/630963#M17022</guid>
      <dc:creator>MarceloLago</dc:creator>
      <dc:date>2014-10-16T11:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract polyline vertices from IFeature ?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-extract-polyline-vertices-from-ifeature/m-p/630964#M17023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcelo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Owen mentioned, the IPointCollection is an interface of the Shape.&amp;nbsp; Rather than casting your feature from IFeature to IPointCollection, you should get the shape from the feature using the Shape property, then cast that to IPointCollection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var myPolyline = myFeature.Shape;&lt;/P&gt;&lt;P&gt;var myPointCollection = (IPointCollection)myPolyline;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Owen also mentioned, the Shape is only guaranteed to be a type of IGeometry, so you don't know that the concrete type is definitely a PolylineClass, so you may need to use the GeometryType property of IGeometry to ensure you are dealing with polyline shapes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Todd &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 23:31:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-extract-polyline-vertices-from-ifeature/m-p/630964#M17023</guid>
      <dc:creator>ToddJackson2</dc:creator>
      <dc:date>2014-10-16T23:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract polyline vertices from IFeature ?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-extract-polyline-vertices-from-ifeature/m-p/630965#M17024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Owen and Todd for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Oct 2014 12:51:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-extract-polyline-vertices-from-ifeature/m-p/630965#M17024</guid>
      <dc:creator>MarceloLago</dc:creator>
      <dc:date>2014-10-22T12:51:49Z</dc:date>
    </item>
  </channel>
</rss>

