ラスタカタログ名は「cat」
間違ったコードを修正
IWorkspaceFactory2 wsf = new ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass(); IRasterWorkspaceEx ws = (IRasterWorkspaceEx)wsf.OpenFromFile(@"f:\img3.mdb", 0); IRasterCatalog cat = ws.OpenRasterCatalog("cat"); IGdbRasterCatalogLayer rastercatalogLayer = new GdbRasterCatalogLayerClass(); rastercatalogLayer.Setup((ITable)cat); axMapControl1.AddLayer((ILayer)rastercatalogLayer);
間違ったコード
IWorkspaceFactory2 wsf = new ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass(); IRasterWorkspaceEx ws = (IRasterWorkspaceEx)wsf.OpenFromFile(@"f:\img3.mdb", 0); IRasterDataset rasterDataset = ws.OpenRasterDataset("rc"); IRasterLayer rasterLayer = new RasterLayer(); rasterLayer.CreateFromDataset(rasterDataset); axMapControl1.AddLayer(rasterLayer);
IWorkspaceFactory2 wsf = new ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass(); IRasterWorkspaceEx ws = (IRasterWorkspaceEx)wsf.OpenFromFile(@"f:\img3.mdb", 0); IRasterCatalog cat = ws.OpenRasterCatalog("cat"); IGdbRasterCatalogLayer rastercatalogLayer = new GdbRasterCatalogLayerClass(); rastercatalogLayer.Setup((ITable)cat); axMapControl1.AddLayer((ILayer)rastercatalogLayer); IRasterDataset rasterDataset = ws.OpenRasterDataset("rc"); IRasterLayer rasterLayer = new RasterLayer(); rasterLayer.CreateFromDataset(rasterDataset); axMapControl1.AddLayer(rasterLayer);
ちなみにファイルジオデータベースでは以下?未確認
IWorkspaceFactory2 workspaceFactory = new FileGDBWorkspaceFactoryClass(); IRasterWorkspaceEx ws = (IRasterWorkspaceEx)workspaceFactory.OpenFromFile(FGDBPath,0); 以下省略