Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to run a map algebra expression in a add-in, and can't seem to get it to work. It's a roving window that interpolates noData areas in a DEM. The expression works in the Python window, and in a Python stand alone script (after replacing the bound raster [inputDEM], with "inputDEM"). In vb it throws a syntax error. Any thoughts?

Thanks so much,


                Dim demPath As String = demLayer.FilePath.Remove((demLayer.FilePath.Length - demLayer.Name.Length), demLayer.Name.Length)
                Dim inputDem As IRasterDataset = OpenRasterDataset(demPath, demLayer.Name)
                Dim mapAlgebra As IMapAlgebraOp = New RasterMapAlgebraOpClass()
                Dim environment As IRasterAnalysisEnvironment = mapAlgebra
                Dim workspaceFactory As IWorkspaceFactory = New RasterWorkspaceFactoryClass()
                environment.OutWorkspace = workspace
                mapAlgebra.BindRaster(inputDem, "inputDEM")
                Dim outputDem As IRaster = mapAlgebra.Execute("Con(IsNull([inputDEM]),FocalStatistics([inputDEM],NbrRectangle(16,16),'MEAN'),[inputDEM])")
                Dim saveDem As ISaveAs2
                saveDem = outputDem
                saveDem.SaveAs("fillGaps", workspace, "GRID")
            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error")
            End Try
share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.