默认头像
路人甲
路人甲
  • 注册日期2005-04-01
  • 发帖数94
  • QQ
  • 铜币466枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1374回复:0

[求助]Reclass ESRI GRID格式(带属性表)的编程实现问题?高手指教

楼主#
更多 发布于:2006-04-20 11:35

我用vc+AO在ATL中开发一个dll,想实现类似Arcmap中空间分析里向Reclassify的功能。
现对一个有属性表的栅格数据(ESRI GRID格式)的value字段(long类型)中的值重新赋值。
编译没有问题,但是嵌入到Arcmap中运行时出现错误,不知道是哪里出错了?请高手指教
属性表有4行,value字段值为0,1,2,3,4,通过编程想将其分别改成0,11,22,33,44
 IDocumentPtr iDocument;
 m_ipApp->get_Document(;iDocument);
 IMxDocumentPtr iMxDocument(iDocument);
 IMapPtr m_ipMap;
 iMxDocument->get_FocusMap(;m_ipMap);

 ILayerPtr pLayer;
 m_ipMap->get_Layer(0,;pLayer);
 IRasterLayerPtr pRLayer(pLayer);
 IRasterPtr pRaster;
 pRLayer->get_Raster(;pRaster);
 IGeoDatasetPtr pGDS;

 IRasterDescriptorPtr pRD(CLSID_RasterDescriptor);
 pRD->Create(pRaster,NULL,_bstr_t("value"));
 pGDS=pRD;

 
 IReclassOpPtr pROp(CLSID_RasterReclassOp);
 IRasterAnalysisEnvironmentPtr pEnv(pROp);
 IWorkspacePtr pWS;
 IWorkspaceFactoryPtr pWSF(CLSID_RasterWorkspaceFactory);
 pWSF->OpenFromFile(_bstr_t("D:\\GISshiyan\\New Folder"),NULL,;pWS);
 pEnv->putref_OutWorkspace(pWS);


 INumberRemapPtr pNRemap(CLSID_NumberRemap);
 pNRemap->MapValue(0,0);
 pNRemap->MapValue(1,11);
 pNRemap->MapValue(2,22);
 pNRemap->MapValue(3,33);
 pNRemap->MapValue(4,44);
 IRemapPtr pRemap(pNRemap);

       
 IGeoDatasetPtr outGDS;
 pROp->ReclassByRemap(pGDS,pRemap,VARIANT_FALSE,;outGDS);
 IRasterPtr outR(outGDS);
 IRasterLayerPtr outRLayer;
 outRLayer->CreateFromRaster(outR);
 ILayerPtr outLayer(outRLayer);
 m_ipMap->AddLayer(outLayer);

 return S_OK;

另外,我的引用为
#import "D:\Program Files\arcexe83\bin\esriCore.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids exclude("OLE_COLOR","OLE_HANDLE")
#import "D:\Program Files\arcexe83\bin\esriSpatialExt.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#import "D:\Program Files\arcexe83\bin\esriSpatialShared.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids exclude("esriGeoAnalysisUnitsEnum","esriRasterNeighborhoodEnum","esriGeoAnalysisFilterEnum","esriGeoAnalysisSemiVariogramEnum","esriGeoAnalysisStatisticsEnum")

喜欢0 评分0
默认头像

返回顶部