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

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

楼主#
更多 发布于:2006-04-20 11:35
<P>我用vc+AO在ATL中开发一个dll,想实现类似Arcmap中空间分析里向Reclassify的功能。<BR>现对一个有属性表的栅格数据(ESRI GRID格式)的value字段(long类型)中的值重新赋值。<BR>编译没有问题,但是嵌入到Arcmap中运行时出现错误,不知道是哪里出错了?请高手指教<BR>属性表有4行,value字段值为0,1,2,3,4,通过编程想将其分别改成0,11,22,33,44<BR>  IDocumentPtr iDocument;<BR>  m_ipApp->get_Document(;iDocument);<BR>  IMxDocumentPtr iMxDocument(iDocument);<BR>  IMapPtr m_ipMap;<BR>  iMxDocument->get_FocusMap(;m_ipMap);</P>
<P>  ILayerPtr pLayer;<BR>  m_ipMap->get_Layer(0,;pLayer);<BR>  IRasterLayerPtr pRLayer(pLayer);<BR>  IRasterPtr pRaster;<BR>  pRLayer->get_Raster(;pRaster);<BR>  IGeoDatasetPtr pGDS;</P>
<P>  IRasterDescriptorPtr pRD(CLSID_RasterDescriptor);<BR>  pRD->Create(pRaster,NULL,_bstr_t("value"));<BR>  pGDS=pRD;</P>
<P>  <BR>  IReclassOpPtr pROp(CLSID_RasterReclassOp);<BR>  IRasterAnalysisEnvironmentPtr pEnv(pROp);<BR>  IWorkspacePtr pWS;<BR>  IWorkspaceFactoryPtr pWSF(CLSID_RasterWorkspaceFactory);<BR>  pWSF->OpenFromFile(_bstr_t("D:\\GISshiyan\\New Folder"),NULL,;pWS);<BR>  pEnv->putref_OutWorkspace(pWS);</P>
<P><BR>  INumberRemapPtr pNRemap(CLSID_NumberRemap);<BR>  pNRemap->MapValue(0,0);<BR>  pNRemap->MapValue(1,11);<BR>  pNRemap->MapValue(2,22);<BR>  pNRemap->MapValue(3,33);<BR>  pNRemap->MapValue(4,44);<BR>  IRemapPtr pRemap(pNRemap);</P>
<P>        <BR>  IGeoDatasetPtr outGDS;<BR>  pROp->ReclassByRemap(pGDS,pRemap,VARIANT_FALSE,;outGDS);<BR>  IRasterPtr outR(outGDS);<BR>  IRasterLayerPtr outRLayer;<BR>  outRLayer->CreateFromRaster(outR);<BR>  ILayerPtr outLayer(outRLayer);<BR>  m_ipMap->AddLayer(outLayer);</P>
<P>  return S_OK;</P>
<P>另外,我的引用为<BR>#import "D:\Program Files\arcexe83\bin\esriCore.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids exclude("OLE_COLOR","OLE_HANDLE")<BR>#import "D:\Program Files\arcexe83\bin\esriSpatialExt.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids <BR>#import "D:\Program Files\arcexe83\bin\esriSpatialShared.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids exclude("esriGeoAnalysisUnitsEnum","esriRasterNeighborhoodEnum","esriGeoAnalysisFilterEnum","esriGeoAnalysisSemiVariogramEnum","esriGeoAnalysisStatisticsEnum")</P>
喜欢0 评分0
游客

返回顶部