<?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 set a response object with my polylines? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-set-a-response-object-with-my-polylines/m-p/588265#M15901</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You're setting the Shape field value here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;polyline.Shape = feature;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is not the correct way to set the Shape field (the above line was correct) and you don't need to do it twice:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;polyline.set_Value(polyline.Fields.FindField("SHAPE"), result);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can't set the Shape.Length field value.&amp;nbsp; It is read-only and is managed by the geodatabase.&amp;nbsp; It will update when you update the Shape field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;polyline.set_Value(polyline.Fields.FindField("SHAPE_Length"), ((IPolyline)result).Length);&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Oct 2013 13:58:16 GMT</pubDate>
    <dc:creator>NeilClemmons</dc:creator>
    <dc:date>2013-10-21T13:58:16Z</dc:date>
    <item>
      <title>How to set a response object with my polylines?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-set-a-response-object-with-my-polylines/m-p/588264#M15900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I&amp;nbsp; have a geo service that seems to finally be working. I have the service setup with a list of Polylines as the returned object. This is what I'm trying to implement but it doesn't work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; IPointCollection points = new MultipointClass();
 points.AddPoint(station);
 points.AddPoint(targets[index]);
 messages.AddMessage(string.Format("Computing distance from origin to target {0}", index));
 Polyline result = distanceComputer.CostPathAsPolyline(points,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hydrographyRasterDataset, 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hydrographyRasterDataset) as Polyline;
 IGeometry feature = result as IGeometry;
 messages.AddMessage("Getting new row for output.");
 IFeatureBuffer buffer = outputClass.CreateFeatureBuffer();
 IFeature polyline = (IFeature) buffer;
 messages.AddMessage("adding shape");
 polyline.Shape = feature;
 messages.AddMessage("adding object");
 polyline.set_Value(polyline.Fields.FindField("SHAPE"), result);
 messages.AddMessage("adding length");
 polyline.set_Value(polyline.Fields.FindField("SHAPE_Length"), ((IPolyline)result).Length);
 messages.AddMessage("Commiting to output");
 outputCursor.InsertFeature(buffer);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;When I try setting the value for "SHAPE" I get an exception and the message is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This spatial reference object cannot be defined from the available information&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So how exactly to I set the polyline in the return object (basically adding rows of Polylines to the OutputFeatureSet) so that it does not blow up?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 12:43:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-set-a-response-object-with-my-polylines/m-p/588264#M15900</guid>
      <dc:creator>MichaelEber</dc:creator>
      <dc:date>2013-10-21T12:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a response object with my polylines?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-set-a-response-object-with-my-polylines/m-p/588265#M15901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You're setting the Shape field value here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;polyline.Shape = feature;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is not the correct way to set the Shape field (the above line was correct) and you don't need to do it twice:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;polyline.set_Value(polyline.Fields.FindField("SHAPE"), result);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can't set the Shape.Length field value.&amp;nbsp; It is read-only and is managed by the geodatabase.&amp;nbsp; It will update when you update the Shape field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;polyline.set_Value(polyline.Fields.FindField("SHAPE_Length"), ((IPolyline)result).Length);&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 13:58:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-set-a-response-object-with-my-polylines/m-p/588265#M15901</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2013-10-21T13:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a response object with my polylines?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-set-a-response-object-with-my-polylines/m-p/588266#M15902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I added more debugging to the code and found that when I get the IGeometryCollection back from CostPathAsPolyline then cast it to Polyline, the resulting object is null!!!???&amp;nbsp; How do I go from an IGeometryCollection to a Polyline correctly?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 15:22:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-set-a-response-object-with-my-polylines/m-p/588266#M15902</guid>
      <dc:creator>MichaelEber</dc:creator>
      <dc:date>2013-10-21T15:22:19Z</dc:date>
    </item>
  </channel>
</rss>

