<?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 ERROR 010067: Error in executing grid expression. Error while reading record [%1%] in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/error-010067-error-in-executing-grid-expression/m-p/1422#M24</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am attempting to use the Viewshed operation with the geoprocessor in C#, and I am running into some wierdness. I need to create a feature in a shapefile dynamically, then feed that to the Viewshed op.&amp;nbsp; This is my code to attempt this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
public void DoViewshed(string elevation, string points, string output)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; object out_raster = GetOutRaster&amp;lt;byte&amp;gt;( output, elevation );

&amp;nbsp;&amp;nbsp;&amp;nbsp; Viewshed op2 = new Viewshed();

&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeatureClass source = OpenFeatureDataset( points );

&amp;nbsp;&amp;nbsp;&amp;nbsp; IPoint pt = new PointClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp; pt.ID = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; pt.X = 2478878.882;
&amp;nbsp;&amp;nbsp;&amp;nbsp; pt.Y =&amp;nbsp; 363573.950;

&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeature feature = source.CreateFeature();
&amp;nbsp;&amp;nbsp;&amp;nbsp; feature.Shape = pt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; feature.Store();

&amp;nbsp;&amp;nbsp;&amp;nbsp; op2.in_raster = elevation;
&amp;nbsp;&amp;nbsp;&amp;nbsp; op2.in_observer_features = points;&amp;nbsp; // I tried using source, too, but that doesn't work, either.
&amp;nbsp;&amp;nbsp;&amp;nbsp; op2.out_raster = out_raster;
&amp;nbsp;&amp;nbsp;&amp;nbsp; op2.curvature_correction = "FLAT_EARTH";
&amp;nbsp;&amp;nbsp;&amp;nbsp; op2.z_factor = 1;

&amp;nbsp;&amp;nbsp;&amp;nbsp; _gp.Execute( op2, null );

&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeatureCursor crsr = source.Update(null,false);
&amp;nbsp;&amp;nbsp;&amp;nbsp; crsr.NextFeature();
&amp;nbsp;&amp;nbsp;&amp;nbsp; crsr.DeleteFeature();
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I do this, I get an error from the geoprocessor: "ERROR 010067: Error in executing grid expression. Error while reading record [%1%]"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My question is: am I doing this the right way? Is there another way I can create a feature in a shapefile and feed it to the Viewshed op?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 May 2010 19:28:00 GMT</pubDate>
    <dc:creator>DavidZwarg</dc:creator>
    <dc:date>2010-05-13T19:28:00Z</dc:date>
    <item>
      <title>ERROR 010067: Error in executing grid expression. Error while reading record [%1%]</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/error-010067-error-in-executing-grid-expression/m-p/1422#M24</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am attempting to use the Viewshed operation with the geoprocessor in C#, and I am running into some wierdness. I need to create a feature in a shapefile dynamically, then feed that to the Viewshed op.&amp;nbsp; This is my code to attempt this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
public void DoViewshed(string elevation, string points, string output)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; object out_raster = GetOutRaster&amp;lt;byte&amp;gt;( output, elevation );

&amp;nbsp;&amp;nbsp;&amp;nbsp; Viewshed op2 = new Viewshed();

&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeatureClass source = OpenFeatureDataset( points );

&amp;nbsp;&amp;nbsp;&amp;nbsp; IPoint pt = new PointClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp; pt.ID = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; pt.X = 2478878.882;
&amp;nbsp;&amp;nbsp;&amp;nbsp; pt.Y =&amp;nbsp; 363573.950;

&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeature feature = source.CreateFeature();
&amp;nbsp;&amp;nbsp;&amp;nbsp; feature.Shape = pt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; feature.Store();

&amp;nbsp;&amp;nbsp;&amp;nbsp; op2.in_raster = elevation;
&amp;nbsp;&amp;nbsp;&amp;nbsp; op2.in_observer_features = points;&amp;nbsp; // I tried using source, too, but that doesn't work, either.
&amp;nbsp;&amp;nbsp;&amp;nbsp; op2.out_raster = out_raster;
&amp;nbsp;&amp;nbsp;&amp;nbsp; op2.curvature_correction = "FLAT_EARTH";
&amp;nbsp;&amp;nbsp;&amp;nbsp; op2.z_factor = 1;

&amp;nbsp;&amp;nbsp;&amp;nbsp; _gp.Execute( op2, null );

&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeatureCursor crsr = source.Update(null,false);
&amp;nbsp;&amp;nbsp;&amp;nbsp; crsr.NextFeature();
&amp;nbsp;&amp;nbsp;&amp;nbsp; crsr.DeleteFeature();
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I do this, I get an error from the geoprocessor: "ERROR 010067: Error in executing grid expression. Error while reading record [%1%]"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My question is: am I doing this the right way? Is there another way I can create a feature in a shapefile and feed it to the Viewshed op?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 May 2010 19:28:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/error-010067-error-in-executing-grid-expression/m-p/1422#M24</guid>
      <dc:creator>DavidZwarg</dc:creator>
      <dc:date>2010-05-13T19:28:00Z</dc:date>
    </item>
  </channel>
</rss>

