IWorkspaceFactory pWorkspaceFactory = new RasterWorkspaceFactoryClass(); IRasterWorkspace2 pRasterWorkspace = (IRasterWorkspace2)pWorkspaceFactory.OpenFromFile("D:\Workspace\Support\140400011", 0); //ラスタ データセットを含むフォルダ IRasterDataset pRasterDataset = pRasterWorkspace.OpenRasterDataset("dem5m_23ku_prj.tif"); //ラスタ データセット名 //事前に pSpatialReference に空間参照を作成 IGeoDatasetSchemaEdit pGeoDatasetSchemaEdit = (IGeoDatasetSchemaEdit )pRasterDataset; pGeoDatasetSchemaEdit.AlterSpatialReference(pSpatialReference);
Sub AlterSpatialReference2RasterDataset() Dim pWorkspaceFactory As IWorkspaceFactory Set pWorkspaceFactory = New RasterWorkspaceFactory Dim pRasterWorkspace As IRasterWorkspace2 Set pRasterWorkspace = pWorkspaceFactory.OpenFromFile("D:\Workspace\Support\140423-000011", 0) Dim pRasterDataset As IRasterDataset Set pRasterDataset = pRasterWorkspace.OpenRasterDataset("dem5m_23ku_prj.tif") Dim pSpatialReference As ISpatialReference Set pSpatialReference = fncSpatialReference(3098, False) '空間参照 Dim pGeoDatasetSchemaEdit As IGeoDatasetSchemaEdit Set pGeoDatasetSchemaEdit = pRasterDataset Call pGeoDatasetSchemaEdit.AlterSpatialReference(pSpatialReference) End Sub