0

I am trying to execute TopoToRaster tool (ArcToolbox>3D Aanalyst Tool>Raster Interpolation>Topo To Raster) in ArcGIS Desktop 10.0 with .NET.

Topo to Raster Input

But get exceptions. My code is here :

  private ESRI.ArcGIS.Analyst3DTools.TopoToRaster InitTool(out object beginningEnvironmentValue)
    {
        _gp = new Geoprocessor { OverwriteOutput = true, AddOutputsToMap = false };

        beginningEnvironmentValue = _gp.GetEnvironmentValue("workspace");

        _gp.SetEnvironmentValue("workspace", _workspace.PathName);
        _gp.SetEnvironmentValue("scratchWorkspace", _workspace.PathName);

        var topoToRaster = new ESRI.ArcGIS.Analyst3DTools.TopoToRaster
        {
            in_topo_features = _inputFeature,//new InputFeatureTopoToRaster() { FeatureLayer = _inputFeature.ToString(), Field = "HGL", Type = "CONTOUR" },
            out_surface_raster = _outputRaster
        };
        return topoToRaster;
    }

and

private readonly object _inputFeature;
    private readonly string _outputRaster;

_inputFeature: is the input feature class path.<<

what is the problem of my input?

I have also tried with class of InputFeature

 public class InputFeatureTopoToRaster
{
    public string FeatureLayer { get; set; }
    public string Field { get; set; }
    public string Type { get; set; }
}
1
  • Please edit your question to show what the error message is and what values the variables _inputFeature and _outputRaster hold?
    – Hornbydd
    Feb 4 '16 at 17:45
1

Finally I found that , space in input feature class directory creates problem in topoToRaster tool execution. from this link :https://geonet.esri.com/thread/51293 ...

and the "_inputFeature" is like this:

_inputFeature = "D:\Temp\line.shp Max_depth CONTOUR"// "shape_file_path..space..Field..space..TYPE"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.