Please help, I can't figure this out at all!! I have a raster that I have created in VBA which I now need its Mean and Standard deviation put into two seperate, constant value, rasters with the same spatial properties (cell size ect) as the input raster. I have gotten into irasterstatistics but the result is incorrect (the mean is 2.44 but the tool displays 1.65). I cannot get this double value into a constant raster either. Here is my code, see what you think.
Thanks
David
Dim pLn As IRaster
Set pLn = pDTWValues ------------------------------------------------------------- this is an igeodataset
Dim pFlwAccBandCol As IRasterBandCollection
Set pFlwAccBandCol = pLn
Dim pFlwAccRasBand As IRasterBand
Set pFlwAccRasBand = pFlwAccBandCol.Item(0)
Dim pFlwAccRasterStatistics As IRasterStatistics
Set pFlwAccRasterStatistics = pFlwAccRasBand.Statistics
Dim FlwMean As Double
Dim FlwSTD As Double
FlwMean = pFlwAccRasterStatistics.Mean
FlwSTD = pFlwAccRasterStatistics.StandardDeviation
MsgBox FlwMean ---------------------------------------------------------------------------------Displays incorrect value
MsgBox FlwSTD ---------------------------------------------------------------------------------Displays incorrect value
Dim pConstantValue2 As IGeoDataset
Set pConstantValue2 = pRasterMakerOp.MakeConstant(FlwMean, False)
Dim pConstantValue3 As IGeoDataset
Set pConstantValue3 = pRasterMakerOp.MakeConstant(FlwSTD, False)
'===============Create Raster Layer===============
Dim pLayer6 As IRasterLayer
Set pLayer6 = New RasterLayer
pLayer6.CreateFromRaster pConstantValue2 ----------------------------------------------------error, will not display
pMap.AddLayer pLayer6
'================================================
Yes I am Still using VBA
Started by
Careysdrum
, Nov 19 2010 10:06 AM
2 replies to this topic
#1
Posted 19 November 2010 - 10:06 AM
#2
Posted 19 November 2010 - 05:41 PM
Hi David,
I think that's the first VBA code I've seen dumped on Cartotalk. You may find quicker elucidation on a forum more specific to using VBA on geospatial rasters. Have you tried an ESRI forum?
I think that's the first VBA code I've seen dumped on Cartotalk. You may find quicker elucidation on a forum more specific to using VBA on geospatial rasters. Have you tried an ESRI forum?
Oregon Metro - Portland, OR
www.oregonmetro.gov
#3
Posted 20 November 2010 - 11:16 AM
In addition to what Matthew said, I think you might get faster results if you just created a model to produce these results.
Cheers,
David
Cheers,
David
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users


Sign In
Create Account
Canada
Back to top
United States









