|
阅读:945回复:0
【求助】delphi+engine点图层生成表面的问题
<P>在用krige插值方法生成表面时总是得不到要输出的结果,代码如下(delphi),其中蓝色变量为输出变量,但一直为空,请高手帮忙?</P>
<P>procedure TfrmMain.Button3Click(Sender: TObject);<BR>var<BR> pWFact: IWorkspaceFactory;<BR> pWks: IWorkspace;<BR> pFWks: IFeatureWorkspace;<BR> pInFCls: IFeatureClass;<BR> pFClsDes: IFeatureClassDescriptor;<BR> pRaster: IRaster;<BR> pRLayer: IRasterLayer;<BR> pLayer: ILayer;<BR> pInGeoDataset, pOutGeoDataset: IGeoDataset;<BR> pRadius: IRasterRadius;<BR> pInterpolatOp: IInterpolationOp;<BR> pEnv: IRasterAnalysisEnvironment;<BR> pPointNum: integer;<BR> pMaxDistance, pBarrier, CellSize: OleVariant;</P> <P> pFieldName, pFieldName1: widestring;<BR> i: integer;<BR>begin<BR> pPointNum := 12;<BR> pMaxDistance := 0;<BR> CellSize := 3;<BR> pFieldName := 'GJZ';</P> <P> pWFact := CoShapeFileWorkspaceFactory.Create as IWorkspaceFactory;<BR> pWFact.OpenFromFile('D:\Projects\ZLS\temp', 0, pWks);<BR> pFWks := pWks as IFeatureWorkspace;<BR> pFWks.OpenFeatureClass('BasicPoint.shp', pInFCls);</P> <P> //set fieldname<BR> pFClsDes := CoFeatureClassDescriptor.create as IFeatureClassDescriptor;<BR> pFClsDes.Create(pInFCls, nil, pFieldName);<BR> pInGeoDataset := pFClsDes as IGeoDataset;<BR> pFClsDes.Get_FieldName(pFieldName1);</P> <P> //Set cell size for output raster.<BR> pInterpolatOp := CoRasterInterpolationOp.Create as IInterpolationOp;<BR> pEnv := pInterpolatOp as IRasterAnalysisEnvironment;<BR> pEnv.SetCellSize(esriRasterEnvValue, CellSize);</P> <P> //Set Radius<BR> pRadius := CoRasterRadius.Create as IRasterRadius;<BR> pRadius.SetVariable(pPointNum, pMaxDistance);</P> <P> //Create GeoDataset for Raster<BR><STRONG><FONT color=#f70968> pInterpolatop.Krige(pInGeoDataset, esriGeoAnalysisCircularSemiVariogram, pRadius, true, pBarrier, <FONT color=#0938f7>pOutGeoDataset</FONT>);</FONT></STRONG></P> <P><STRONG><FONT color=#f70968> //Add the Raster to map<BR> pRaster := <FONT color=#1111ee>pOutGeoDataset</FONT> as IRaster; </FONT></STRONG><BR> pRLayer := CoRasterLayer.Create as IRasterLayer;<BR> pRLayer.CreateFromRaster(pRaster);<BR> pLayer := pRLayer as ILayer;<BR> pMap.AddLayer(pLayer, 0);</P> <P>end;</P> |
|