<?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: &amp;quot;No support for this geometry type&amp;quot; error when creating PolyLines in Shape File in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-no-support-for-this-geometry-type-amp/m-p/688354#M18512</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;lineFeature.Shape = (IGeometry)path;&lt;BR /&gt;&lt;BR /&gt;You're attempting to add a Path geometry to a Polyline shapefile.&amp;nbsp; A Path and a Polyline are not the same thing.&amp;nbsp; Add the Polyline you're creating instead of the Path.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi there Neil,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's great it worked - another typo as a result of converting the code (and being rather new to all this ArcGIS stuff!!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So to summarise the fix was to change&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;lineFeature.Shape = (IGeometry)path;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;to&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;lineFeature.Shape = (IGeometry)polyLine;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Mar 2011 07:44:07 GMT</pubDate>
    <dc:creator>GaryBroyd</dc:creator>
    <dc:date>2011-03-24T07:44:07Z</dc:date>
    <item>
      <title>&amp;quot;No support for this geometry type&amp;quot; error when creating PolyLines in Shape File</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-no-support-for-this-geometry-type-amp/m-p/688352#M18510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everybody,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm in the process of moving our VB6 code which integrates with ArcMap to .Net and have run into a problem trying to add some PolyLines into a shape file.&amp;nbsp; We use very similar code for adding points into a shape file but can't work out why it's coming up with the error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;No support for this geometry type&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We are creating a Shape File and populating it with PolyLine features from a series of coordinates (these are used to symbolise a link between two other map items "Points" that exist in a separate layer)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the basic code (some variables etc are defined elsewhere but it the basic ArcObjects interaction is there).&amp;nbsp; It throws the exception on the last line of code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;//Create a Shape file workspace factory
ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactory shapefileWorkspaceFactory = CreateObject( "esriDataSourcesFile.ShapefileWorkspaceFactory" ) as ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactory;
ESRI.ArcGIS.Geodatabase.IFeatureWorkspace featureWorkspace = shapefileWorkspaceFactory.OpenFromFile( System.IO.Path.GetDirectoryName( linksDataFilePath ), 0 ) as IFeatureWorkspace;

IWorkspace workspace = featureWorkspace as IWorkspace;

ESRI.ArcGIS.Geodatabase.IFields fields = new ESRI.ArcGIS.Geodatabase.Fields();
ESRI.ArcGIS.Geodatabase.IFieldsEdit fieldsEdit = fields as ESRI.ArcGIS.Geodatabase.IFieldsEdit;
IField shapeField = new ESRI.ArcGIS.Geodatabase.Field();
IFieldEdit shapeFieldEdit = shapeField as IFieldEdit;

shapeFieldEdit.Name_2 = "Shape";
shapeFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;

IGeometryDef geometryDef = CreateObject( "esriGeoDatabase.GeometryDef" ) as IGeometryDef;
IGeometryDefEdit geometryDefEdit = geometryDef as IGeometryDefEdit;

geometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPolyline;

ISpatialReference spatialReference = CreateObject( "esriDataSourcesFile.UnknownCoordinateSystem" ) as ISpatialReference;
geometryDefEdit.SpatialReference_2 = spatialReference;

shapeFieldEdit.GeometryDef_2 = geometryDef;

fieldsEdit.AddField( shapeField );

IFeatureClass featureClass = featureWorkspace.CreateFeatureClass( filenameOnly, fields, null, null, esriFeatureType.esriFTSimple, shapeFieldEdit.Name, "" );


CreateFields( headerLine, featureClass );
ITable table = featureClass as ITable;
ICursor cursor = table.Insert( false );
IRowBuffer rowBuffer = table.CreateRowBuffer();
IFeature lineFeature = rowBuffer as IFeature;
IPoint startPoint = CreateObject( "esriGeometry.Point" ) as IPoint;
IPoint endPoint = CreateObject( "esriGeometry.Point" ) as IPoint;
ILine line = CreateObject( "esriGeometry.Line" ) as ILine;
IGeometryCollection polyLine = CreateObject( "esriGeometry.PolyLine" ) as IGeometryCollection;
ISegmentCollection path = CreateObject( "esriGeometry.Path" ) as ISegmentCollection;

//Coordinate variables (of type double) defined elsewhere
startPoint.PutCoords( x1, y1 );
endPoint.PutCoords( x2, y2 );
line.PutCoords( startPoint, endPoint );

object missing1 = Type.Missing;
object missing2 = Type.Missing;
path.AddSegment( (ISegment)line, ref missing1, ref missing2 );
polyLine.AddGeometry( (IGeometry)path, ref missing1, ref missing2 );

//Set the field values in
rowBuffer.set_Value( 3, mapId );
rowBuffer.set_Value( 4, mapColour );
rowBuffer.set_Value( 5, mapDirection );
rowBuffer.set_Value( 6, x1 );
rowBuffer.set_Value( 7, y1 );
rowBuffer.set_Value( 8, x2 );
rowBuffer.set_Value( 9, y2 );

cursor.InsertRow( rowBuffer );

//***************************************
//THROW THE EXCEPTION HERE
lineFeature.Shape = (IGeometry)path;
//***************************************&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2011 14:38:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-no-support-for-this-geometry-type-amp/m-p/688352#M18510</guid>
      <dc:creator>GaryBroyd</dc:creator>
      <dc:date>2011-03-23T14:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: "No support for this geometry type" error when creating PolyLines in Shape File</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-no-support-for-this-geometry-type-amp/m-p/688353#M18511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;lineFeature.Shape = (IGeometry)path;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You're attempting to add a Path geometry to a Polyline shapefile.&amp;nbsp; A Path and a Polyline are not the same thing.&amp;nbsp; Add the Polyline you're creating instead of the Path.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2011 16:52:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-no-support-for-this-geometry-type-amp/m-p/688353#M18511</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2011-03-23T16:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: "No support for this geometry type" error when creating PolyLines in Shape File</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-no-support-for-this-geometry-type-amp/m-p/688354#M18512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;lineFeature.Shape = (IGeometry)path;&lt;BR /&gt;&lt;BR /&gt;You're attempting to add a Path geometry to a Polyline shapefile.&amp;nbsp; A Path and a Polyline are not the same thing.&amp;nbsp; Add the Polyline you're creating instead of the Path.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi there Neil,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's great it worked - another typo as a result of converting the code (and being rather new to all this ArcGIS stuff!!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So to summarise the fix was to change&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;lineFeature.Shape = (IGeometry)path;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;to&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;lineFeature.Shape = (IGeometry)polyLine;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Mar 2011 07:44:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/amp-quot-no-support-for-this-geometry-type-amp/m-p/688354#M18512</guid>
      <dc:creator>GaryBroyd</dc:creator>
      <dc:date>2011-03-24T07:44:07Z</dc:date>
    </item>
  </channel>
</rss>

