<?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 Buffer polygon intersect error : ArcObject Exception from HRESULT: 0x80040215 in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/buffer-polygon-intersect-error-arcobject-exception/m-p/388033#M10320</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I try the get the plogon area with in buffer polygon area. But its always gives error. My error code is "ArcObject Exception from HRESULT: 0x80040215"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code is given below :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Convert the JSON line to an ArcObjects Polyline&lt;/P&gt;&lt;P&gt;&amp;nbsp; var missing = Type.Missing;&lt;/P&gt;&lt;P&gt;&amp;nbsp; IPolyline routePolyline = new PolylineClass();&lt;/P&gt;&lt;P&gt;&amp;nbsp; foreach (var point in args.RoutePolyline)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; (routePolyline as IPointCollection).AddPoint(&lt;/P&gt;&lt;P&gt;&amp;nbsp; new PointClass {X = point.X, Y = point.Y, SpatialReference = _webMercator},&lt;/P&gt;&lt;P&gt;&amp;nbsp; ref missing, ref missing);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; routePolyline.SpatialReference = _webMercator;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Buffer it...&lt;/P&gt;&lt;P&gt;&amp;nbsp; var topologicalOperator = routePolyline as ITopologicalOperator;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var routeBufferPolygon = topologicalOperator.Buffer(args.BufferDistance) as IPolygon;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; foreach (var layer in layersToArea)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var layerName = layer.Key;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var jsonPropertyName = layer.Value;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Get the feature class and error out if it's not found&lt;/P&gt;&lt;P&gt;&amp;nbsp; var fc = Utilities.GetFeatureClass(_mapServer, layerName);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (fc == null)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var errMessage = string.Format("Can't find the feature class for '{0}'.", layerName);&lt;/P&gt;&lt;P&gt;&amp;nbsp; _logger.LogMessage(ServerLogger.msgType.error, "GetStats", -1000, errMessage);&lt;/P&gt;&lt;P&gt;&amp;nbsp; return ErrorResponse(errMessage);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Setup a spatial filter for intersecting our buffer area&lt;/P&gt;&lt;P&gt;&amp;nbsp; ISpatialFilter sf = new SpatialFilterClass();&lt;/P&gt;&lt;P&gt;&amp;nbsp; sf.GeometryField = fc.ShapeFieldName;&lt;/P&gt;&lt;P&gt;&amp;nbsp; sf.Geometry = routeBufferPolygon;&lt;/P&gt;&lt;P&gt;&amp;nbsp; sf.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Find the position of the "SQMI" field in the feature class.&lt;/P&gt;&lt;P&gt;&amp;nbsp; int nameFieldPosition = fc.FindField("SQMI");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Execute the query and iterate through the cursor's results.&lt;/P&gt;&lt;P&gt;&amp;nbsp; IFeatureCursor resultsFeatureCursor = fc.Search(sf, true);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; IFeature resultsFeature = null;&lt;/P&gt;&lt;P&gt;&amp;nbsp; double totalArea = 0.0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; while ((resultsFeature = resultsFeatureCursor.NextFeature()) != null)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG&gt;// problem accrued here&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; IPolygon clippedResultsGeometry = (IPolygon)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; topologicalOperator.Intersect(resultsFeature.Shape,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; ESRI.ArcGIS.Geometry.esriGeometryDimension.esriGeometry2Dimension);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //clippedResultsGeometry.Densify(0, 0);&amp;nbsp; // Densify to maintain curved appearance when converted to JSON.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Get statistics.&lt;/P&gt;&lt;P&gt;&amp;nbsp; IArea area = (IArea)clippedResultsGeometry;&lt;/P&gt;&lt;P&gt;&amp;nbsp; totalArea += area.Area;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; jsonResult.AddDouble(jsonPropertyName, totalArea);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 Jul 2015 11:06:10 GMT</pubDate>
    <dc:creator>muthukamatchiganesan</dc:creator>
    <dc:date>2015-07-31T11:06:10Z</dc:date>
    <item>
      <title>Buffer polygon intersect error : ArcObject Exception from HRESULT: 0x80040215</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/buffer-polygon-intersect-error-arcobject-exception/m-p/388033#M10320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I try the get the plogon area with in buffer polygon area. But its always gives error. My error code is "ArcObject Exception from HRESULT: 0x80040215"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code is given below :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Convert the JSON line to an ArcObjects Polyline&lt;/P&gt;&lt;P&gt;&amp;nbsp; var missing = Type.Missing;&lt;/P&gt;&lt;P&gt;&amp;nbsp; IPolyline routePolyline = new PolylineClass();&lt;/P&gt;&lt;P&gt;&amp;nbsp; foreach (var point in args.RoutePolyline)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; (routePolyline as IPointCollection).AddPoint(&lt;/P&gt;&lt;P&gt;&amp;nbsp; new PointClass {X = point.X, Y = point.Y, SpatialReference = _webMercator},&lt;/P&gt;&lt;P&gt;&amp;nbsp; ref missing, ref missing);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; routePolyline.SpatialReference = _webMercator;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Buffer it...&lt;/P&gt;&lt;P&gt;&amp;nbsp; var topologicalOperator = routePolyline as ITopologicalOperator;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var routeBufferPolygon = topologicalOperator.Buffer(args.BufferDistance) as IPolygon;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; foreach (var layer in layersToArea)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var layerName = layer.Key;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var jsonPropertyName = layer.Value;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Get the feature class and error out if it's not found&lt;/P&gt;&lt;P&gt;&amp;nbsp; var fc = Utilities.GetFeatureClass(_mapServer, layerName);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (fc == null)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var errMessage = string.Format("Can't find the feature class for '{0}'.", layerName);&lt;/P&gt;&lt;P&gt;&amp;nbsp; _logger.LogMessage(ServerLogger.msgType.error, "GetStats", -1000, errMessage);&lt;/P&gt;&lt;P&gt;&amp;nbsp; return ErrorResponse(errMessage);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Setup a spatial filter for intersecting our buffer area&lt;/P&gt;&lt;P&gt;&amp;nbsp; ISpatialFilter sf = new SpatialFilterClass();&lt;/P&gt;&lt;P&gt;&amp;nbsp; sf.GeometryField = fc.ShapeFieldName;&lt;/P&gt;&lt;P&gt;&amp;nbsp; sf.Geometry = routeBufferPolygon;&lt;/P&gt;&lt;P&gt;&amp;nbsp; sf.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Find the position of the "SQMI" field in the feature class.&lt;/P&gt;&lt;P&gt;&amp;nbsp; int nameFieldPosition = fc.FindField("SQMI");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Execute the query and iterate through the cursor's results.&lt;/P&gt;&lt;P&gt;&amp;nbsp; IFeatureCursor resultsFeatureCursor = fc.Search(sf, true);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; IFeature resultsFeature = null;&lt;/P&gt;&lt;P&gt;&amp;nbsp; double totalArea = 0.0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; while ((resultsFeature = resultsFeatureCursor.NextFeature()) != null)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG&gt;// problem accrued here&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; IPolygon clippedResultsGeometry = (IPolygon)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; topologicalOperator.Intersect(resultsFeature.Shape,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; ESRI.ArcGIS.Geometry.esriGeometryDimension.esriGeometry2Dimension);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //clippedResultsGeometry.Densify(0, 0);&amp;nbsp; // Densify to maintain curved appearance when converted to JSON.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Get statistics.&lt;/P&gt;&lt;P&gt;&amp;nbsp; IArea area = (IArea)clippedResultsGeometry;&lt;/P&gt;&lt;P&gt;&amp;nbsp; totalArea += area.Area;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; jsonResult.AddDouble(jsonPropertyName, totalArea);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jul 2015 11:06:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/buffer-polygon-intersect-error-arcobject-exception/m-p/388033#M10320</guid>
      <dc:creator>muthukamatchiganesan</dc:creator>
      <dc:date>2015-07-31T11:06:10Z</dc:date>
    </item>
  </channel>
</rss>

