<?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 Polyline forming closed segment in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315629#M8228</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: e_saurabh&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28156[/ATTACH][ATTACH=CONFIG]28157[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We are facing a real complex issue regarding creating the Polyline from the coordinate values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The issue is regarding polyline geometry, when we get the coordinates of the SQL Geometry and trying to create ARCGIS Geometry using PointCollection and Polyline class of IPointCollection and IGeometry interfaces through AddPointCollection method, the last and first vertices of the polyline geometry is getting joined automatically and forms a line segment and creates a shape like polygon and then pushes this to ArcSDE. This happens for simple and complex polylines. Attached is the actual polyline in the SQl Server geometry and the polyline which forms a close segment in ArcSDE GDB. We are using SQl Server 2008, ArcGIS Server 10.0 and ArcSDE 10.0. Attached are the images.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This has become a show stopper for our application. If anyone can please respond quickly on this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Saurabh.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Oct 2013 03:21:10 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2013-10-09T03:21:10Z</dc:date>
    <item>
      <title>Polyline forming closed segment</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315629#M8228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: e_saurabh&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]28156[/ATTACH][ATTACH=CONFIG]28157[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We are facing a real complex issue regarding creating the Polyline from the coordinate values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The issue is regarding polyline geometry, when we get the coordinates of the SQL Geometry and trying to create ARCGIS Geometry using PointCollection and Polyline class of IPointCollection and IGeometry interfaces through AddPointCollection method, the last and first vertices of the polyline geometry is getting joined automatically and forms a line segment and creates a shape like polygon and then pushes this to ArcSDE. This happens for simple and complex polylines. Attached is the actual polyline in the SQl Server geometry and the polyline which forms a close segment in ArcSDE GDB. We are using SQl Server 2008, ArcGIS Server 10.0 and ArcSDE 10.0. Attached are the images.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This has become a show stopper for our application. If anyone can please respond quickly on this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Saurabh.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2013 03:21:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315629#M8228</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-10-09T03:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: Polyline forming closed segment</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315630#M8229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;without the actual code fragment it is very difficult to help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2013 11:54:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315630#M8229</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2013-10-09T11:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Polyline forming closed segment</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315631#M8230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: e_saurabh&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;without the actual code fragment it is very difficult to help.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Please find the code below...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;IFeature feature = featureClass.CreateFeature();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IGeometry lineGeometry;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Polyline polyline;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;string shapeGeoData = string.Empty;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IPointCollection pointCollection;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;shapeGeoData = geoData.Remove(0, 10);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;shapeGeoData = shapeGeoData.Replace("(", "");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;shapeGeoData = shapeGeoData.Replace(")", "");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;shapeGeoData = shapeGeoData.Replace(", ", ",");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;shapeGeoData = shapeGeoData.Replace(" ", ";");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;shapeGeoData = shapeGeoData.Replace(",", " ");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;shapeGeoData = shapeGeoData.Replace(";", ",");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;shapeGeoData = shapeGeoData.TrimStart(',');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;polyline = (Polyline)serverContext.CreateObject("esriGeometry.Polyline");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pointCollection = polyline as IPointCollection;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;string value = shapeGeoData &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;string[] geoDataArray = value.Split(new char[] { ' ' });&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IPoint point = (IPoint)serverContext.CreateObject("esriGeometry.Point");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;object missingObject = Type.Missing;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for (int count = 0; count &amp;lt; geoDataArray.Length; count++)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointArray = geoDataArray[count].Split(new char[] { ',' });&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; latitude = Convert.ToDouble(pointArray[0].ToString());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; longitude = Convert.ToDouble(pointArray[1].ToString());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; point.X = latitude;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; point.Y = longitude;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointCollection.AddPoint(point, ref missingObject, ref missingObject);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;polyline.AddPointCollection(pointCollection);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ISpatialReferenceFactory spatialReferenceFactory;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ISpatialReferenceResolution spatialReferenceResolution;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ISpatialReferenceTolerance spatialReferenceTolerance;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ISpatialReference spatialReference=null;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SpatialReferenceFactory = serverContext.CreateObject("esriGeometry.SpatialReferenceEnvironment") as ISpatialReferenceFactory;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//Create a projected coordinate system and define its domain, resolution, and x,y tolerance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;spatialReferenceResolution = spatialReferenceFactory.CreateGeographicCoordinateSystem(SRID) as ISpatialReferenceResolution;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;spatialReferenceResolution.ConstructFromHorizon();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;spatialReferenceTolerance = spatialReferenceResolution as ISpatialReferenceTolerance;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;spatialReferenceTolerance.SetDefaultXYTolerance();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;spatialReference = spatialReferenceResolution as ISpatialReference;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;lineGeometry.SpatialReference = spatialReference &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ITopologicalOperator topologicalOperator = polyline as ITopologicalOperator;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;topologicalOperator.Simplify();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;feature.Shape = lineGeometry;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;feature.Store();&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2013 13:08:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315631#M8230</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-10-09T13:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: Polyline forming closed segment</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315632#M8231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here you are creating a new polyline:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;polyline = (Polyline)serverContext.CreateObject("esriGeometry.Polyline");&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here you are performing a QI from IPoint to IPointCollection:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pointCollection = polyline as IPointCollection;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here you are adding points to the point collection:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for (int count = 0; count &amp;lt; geoDataArray.Length; count++)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pointArray = geoDataArray[count].Split(new char[] { ',' });&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;latitude = Convert.ToDouble(pointArray[0].ToString());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;longitude = Convert.ToDouble(pointArray[1].ToString());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;point.X = latitude;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;point.Y = longitude;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pointCollection.AddPoint(point, ref missingObject, ref missingObject);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At this point you have created the polyline and added the points.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But, here you add the points again by adding the point collection to the polyline:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;polyline.AddPointCollection(pointCollection);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You don't want to do that because you're adding the points twice.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2013 13:37:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315632#M8231</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2013-10-09T13:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Polyline forming closed segment</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315633#M8232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: e_saurabh&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Here you are creating a new polyline:&lt;BR /&gt;polyline = (Polyline)serverContext.CreateObject("esriGeometry.Polyline");&lt;BR /&gt;&lt;BR /&gt;Here you are performing a QI from IPoint to IPointCollection:&lt;BR /&gt;pointCollection = polyline as IPointCollection;&lt;BR /&gt;&lt;BR /&gt;Here you are adding points to the point collection:&lt;BR /&gt;for (int count = 0; count &amp;lt; geoDataArray.Length; count++)&lt;BR /&gt;{&lt;BR /&gt;pointArray = geoDataArray[count].Split(new char[] { ',' });&lt;BR /&gt;latitude = Convert.ToDouble(pointArray[0].ToString());&lt;BR /&gt;longitude = Convert.ToDouble(pointArray[1].ToString());&lt;BR /&gt;point.X = latitude;&lt;BR /&gt;point.Y = longitude;&lt;BR /&gt;pointCollection.AddPoint(point, ref missingObject, ref missingObject);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;At this point you have created the polyline and added the points.&lt;BR /&gt;But, here you add the points again by adding the point collection to the polyline:&lt;BR /&gt;polyline.AddPointCollection(pointCollection);&lt;BR /&gt;&lt;BR /&gt;You don't want to do that because you're adding the points twice.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Neil,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot!!&amp;nbsp; Your click worked right away. Now this works fine. Probably some coding mistakes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Saurabh.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2013 19:40:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315633#M8232</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-10-09T19:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Polyline forming closed segment</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315634#M8233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You may also want to check or change:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;point.X = latitude;
point.Y = longitude;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:01:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315634#M8233</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T15:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Polyline forming closed segment</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315635#M8234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: e_saurabh&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sure Sean.. will follow up a check on this. Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Saurabh.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 12:45:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/polyline-forming-closed-segment/m-p/315635#M8234</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-10-10T12:45:42Z</dc:date>
    </item>
  </channel>
</rss>

