dzwarg

ERROR 010067: Error in executing grid expression. Error while reading record [%1%]

Discussion created by dzwarg on May 13, 2010
Hello,

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.  This is my code to attempt this:

public void DoViewshed(string elevation, string points, string output)
{
    object out_raster = GetOutRaster<byte>( output, elevation );

    Viewshed op2 = new Viewshed();

    IFeatureClass source = OpenFeatureDataset( points );

    IPoint pt = new PointClass();
    pt.ID = 0;
    pt.X = 2478878.882;
    pt.Y =  363573.950;

    IFeature feature = source.CreateFeature();
    feature.Shape = pt;
    feature.Store();

    op2.in_raster = elevation;
    op2.in_observer_features = points;  // I tried using source, too, but that doesn't work, either.
    op2.out_raster = out_raster;
    op2.curvature_correction = "FLAT_EARTH";
    op2.z_factor = 1;

    _gp.Execute( op2, null );

    IFeatureCursor crsr = source.Update(null,false);
    crsr.NextFeature();
    crsr.DeleteFeature();
}


When I do this, I get an error from the geoprocessor: "ERROR 010067: Error in executing grid expression. Error while reading record [%1%]"

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?

Thanks

Outcomes