Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to run a map algebra expression in a vb.net 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,

DR

Try
                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

 
discard

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

Browse other questions tagged or ask your own question.