English

Problem: Extract grid by graphic sample script gives errors

Description

The Spatial Analyst sample script, grextrct.ave, gives incorrect results.

Cause

The extent of the output grid is not properly set to that of the shape.

Solution or Workaround

Change the following lines of code:

  1. From:

    Code:
    ae = theView.GetExtension(AnalysisEnvironment)
    ae.SetExtent(#ANALYSISENV_VALUE, ashpext)
    ae.SetCellSize(#ANALYSISENV_VALUE, g.getcellsize)

  2. To:

    Code:
    grid.setanalysisextent(#GRID_ENVTYPE_VALUE,ashpext)
    grid.setanalysiscellsize(#GRID_ENVTYPE_VALUE,g.getcellsize)