Click or drag to resize
XDL

XRSMetaData Class

XRSMetaData클래스는 영상정보에 대한 메타 데이터를 정의된다. XRSMetaData에서 정의되는 Meta데이터는 Domain으로 범주가 형성되고 그 하부에 Key값과 Value값으로 구성된다.
Inheritance Hierarchy
System.Object
  Pixoneer.NXDL.NRS.XRSMetaData

Namespace: Pixoneer.NXDL.NRS
Assembly: NXDLrs (in NXDLrs.dll) Version: 2.0.3.38
Syntax
C#
public class XRSMetaData : IDisposable

The XRSMetaData type exposes the following members.

Constructors
 NameDescription
Public methodXRSMetaData() XRSMetaData클래스의 기본 생성자로서, 멤버변수에 대하여 초기화를 수행한다.
Public methodXRSMetaData(XRSMetaData*) XRSMetaData클래스의 기본 생성자로서, 멤버변수에 대하여 초기화를 수행한다.
Top
Methods
 NameDescription
Public methodGetDomainList XRSLoadFile객체에 포함된 메타데이터로부터 카테고리 분류인 Domain List를 얻는다.
Public methodGetKeyList() XRSLoadFile객체에 포함된 메타데이터로부터 Key List를 얻는다.
Public methodGetKeyList(String) XRSLoadFile객체에 포함된 메타데이터로부터 특정 Domain에 해당하는 Key List를 얻는다.
Public methodGetValue(String) 특정 Key에 해당하는 Value값을 얻는다.
Public methodGetValue(String, String) 특정 Key에 해당하는 Value값을 얻는다.
Public methodRemoveKey 특정 Key를 삭제한다..
Public methodSaveXml XRSMetaData에 저장된 데이타 셋을 xml 파일로 저장한다.
Public methodSetValue(String, String) 특정 Key에 해당하는 Value값을 설정한다.
Public methodSetValue(String, String, String) 특정 Key에 해당하는 Value값을 설정한다.
Top
Remarks

XRSLoadFile의 MetaData에서는 입력 파일의 메타 정보를 저장하고 있고, XRSSaveFile의 MetaData에는 출력 파일의 메타 정보 및 출력 옵션을 설정할 수 있다.

Example
XRSLoadFile 객체에서 메타정보를 가져온다. XRasterIO를 이용하여 영상 파일을 읽을 때 LoadFile의 매개변수 중 bMetaLoad를 true롤 하여 로딩해야 한다.
C#
XRasterIO RasterIO = new XRasterIO();
String strError = "";
if (RasterIO.Initialize(out strError) == false)
{
    return;
}

String strFilePathLoad = "D:\\Sample\\IKONOS.ntf";
XRSLoadFile xrsFileInput = RasterIO.LoadFile(strFilePathLoad, out strError, false, eIOCreateXLDMode.All_NoMsg, true);

XRSMetaData data = xrsFileInput.MetaData;
string[] strDomain = data.GetDomainList();
for (int i = 0; i <  strDomain.Length; i++)
{
    string[] strKey = data.GetKeyList(strDomain[i]);
    for (int j = 0; j <  strKey.Length; j++)
    {
        string strValue = data.GetValue(strKey[j], strDomain[i]);
        System.Console.WriteLine("Domain : {0}, (Key, value) => ({1}, {2})", strDomain[i], strKey[j], strValue);
    }
}
XRSSaveFile에 저장하고자 하는 밴드를 추가한 후 GDAL의 GeoTiff 형식으로 파일을 저장한다. 이 때 Tiff 파일은 타일크기가 256 x 256인 타일 형식으로 저장하여 JPEG 압축을 이용한다.
C#
using Pixoneer.NXDL;
using Pixoneer.NXDL.NRS;
using Pixoneer.NXDL.NIO;

XRasterIO RasterIO = new XRasterIO();
String strError = "";
if (RasterIO.Initialize(out strError) == false)
{
    return;
}

String strFilePathLoad = "D:\\Sample\\IKONOS.xdm";
XRSLoadFile xrsFileInput = RasterIO.LoadFile(strFilePathLoad, out strError, false, eIOCreateXLDMode.All_NoMsg);

// Create XRSSaveFile
XRSSaveFile fileSave = new XRSSaveFile();
for (int i = 0; i < xrsFileInput.NumBand; i++)
{
    XDMBand band = (XDMBand)xrsFileInput.GetBandAt(i);
    fileSave.AddBand(ref band);
}

XRSMetaData metaData = new XRSMetaData();
metaData.SetValue("TILED", "YES");
metaData.SetValue("BLOCKXSIZE", "256");
metaData.SetValue("BLOCKYSIZE", "256");
metaData.SetValue("COMPRESS", "JPEG");
fileSave.MetaData = metaData;

XThread thd = null;
String strFilePathSave = "D:\\Sample\\Out_Save.tif";
if (!RasterIO.Export(ref fileSave, strFilePathSave, "GTiff", out strError, thd))
{
    return;
}
XDM 파일로 저장할 때 XDK 라이브러리의 기본 EPOT 저장구조인 XEPOT_CM_NONE 구조로 저장하는 예제이다.
XRSMetaData를 이용하여 XRS_TAG_BAND_COMPRESSION 키워드를 이용하여 XEPOT_CM_NONE 값을 설정한다.
C#
using Pixoneer.NXDL;
using Pixoneer.NXDL.NRS;
using Pixoneer.NXDL.NIO;

XRasterIO RasterIO = new XRasterIO();
String strError = "";
if (RasterIO.Initialize(out strError) == false)
{
    return;
}

String strFilePathLoad = "D:\\Sample\\IKONOS.tif";
XRSLoadFile xrsFileInput = RasterIO.LoadFile(strFilePathLoad, out strError, false, eIOCreateXLDMode.All_NoMsg);

// Create XRSSaveFile
XRSSaveFile fileSave = new XRSSaveFile();
for (int i = 0; i < xrsFileInput.NumBand; i++)
{
    XDMBand band = (XDMBand)xrsFileInput.GetBandAt(i);
    fileSave.AddBand(ref band);
}

XRSMetaData metaData = new XRSMetaData();
// XDL XDM 기본 구조인 XEPOT_CM_TIP이 아닌, XEPOT_CM_NONE으로 저장하도록 설정
metaData.SetValue("XRS_TAG_BAND_COMPRESSION", "XEPOT_CM_NONE", "XDM");
fileSave.MetaData = metaData;

XThread thd = null;
String strFilePathSave = "D:\\Sample\\Out_Save.XDM";
if (!RasterIO.Export(ref fileSave, strFilePathSave, "XDM", out strError, thd))
{
    return;
}
See Also