래스터, 고도와 타일
래스터의 밴드와 픽셀을 읽고, 메모리 래스터를 수정하거나 GeoTIFF로 저장할 수 있습니다. 타일 API는 압축 타일을 읽고 지형 및 벡터 타일 데이터의 속성을 조회합니다.
.NET에서 사용하기
픽셀·고도 또는 타일을 읽고 지도 레이어로 표시합니다. 연속 픽셀은 RasterDataSource, 타일 좌표 기반 데이터는 TileDataset을 사용합니다.
호출 순서: 데이터 열기 → 크기·CRS·NoData 확인 → 필요한 범위 읽기 → 레이어 또는 파일 출력.
Note
픽셀 형식과 버퍼 크기를 확인합니다. NoData와 타일 부재는 유효한 값 0과 구분합니다.
개념과 사용 순서 · 관계와 처리 흐름 · .NET 시작하기
C# 실행 예제
아래는 SDK 샘플의 실제 코드 영역입니다. 초기화·오류 처리·해제를 포함한 전체 흐름은 사용 가이드에서 확인하세요.
// ReadPixelRaw returns the bytes of one pixel in the band's data type (here
// a 4-byte float). Column c and row r cover the map area that starts at
// Gt0 + c * Gt1, Gt3 + r * Gt5; the pixel center is half a pixel further.
// The window here is the 3 x 3 pixels around column 149, row 49, next to
// the hill top.
private static bool ReadPixels(glsRasterDataSource raster, glsGeoTransform t)
{
const int c0 = 148;
const int r0 = 48;
int matching = 0;
for (int row = 0; row < 3; ++row)
{
for (int column = 0; column < 3; ++column)
{
double lon = t.Gt0 + (c0 + column + 0.5) * t.Gt1;
double lat = t.Gt3 + (r0 + row + 0.5) * t.Gt5;
if (Near(ReadFloat(raster, c0 + column, r0 + row), DemHeightAt(lon, lat), 1e-3))
{
++matching;
}
}
}
double centerLon = t.Gt0 + (149 + 0.5) * t.Gt1;
double centerLat = t.Gt3 + (49 + 0.5) * t.Gt5;
float center = ReadFloat(raster, 149, 49);
Console.WriteLine("[sample] 3 x 3 pixels at column 148, row 48: {0} of 9 match the formula", matching);
Console.WriteLine("[sample] pixel (149, 49): center {0} {1}, value {2}",
F(centerLon, 5), F(centerLat, 5), F(center, 3));
return (matching == 9 && Near(centerLon, 10.06975, 1e-9) && Near(centerLat, 50.04025, 1e-9)
&& Near(center, DemHeightAt(centerLon, centerLat), 1e-3))
|| Unexpected("expected the pixels of the formula");
}
래스터 데이터와 밴드
픽셀 위치는 왼쪽 위에서 0으로 세고 밴드 번호는 1부터 셉니다. 값을 읽을 때 밴드 저장 형식과 NoData 값을 함께 확인합니다.
glsRasterDataSource
- glsRasterDataSource
- Extent()
- GeoTransform()
- SetPixels(float[])
- SetPixels(byte[])
- SetNoDataValue(bool, double)
- ExportGeoTiff(string)
- ReadPixelRaw(int, int)
- WritePixelRaw(int, int, byte[])
- Band(int)
- Dispose()
- ~glsRasterDataSource()
- Capabilities
- Crs
- PixelFormat
- BandCount
- Height
- Width
- Name
glsRasterBand
타일 데이터셋과 이미지 타일 소스
저장 행 방향과 관계없이 타일 키의 행은 위에서부터 셉니다. 네트워크 타일을 요청하면 다운로드 중인 키를 현재 조회에서는 찾지 못할 수 있습니다.
glsTileDataset
- glsTileDataset
- Bounds3857()
- TileRange(int)
- HasTile(glsTileKey)
- ReadTile(glsTileKey, out glsTileFormat)
- OpenTileDataSource()
- OpenTileDataSourceForZoom(int)
- OpenTerrainTileDataSource()
- Dispose()
- ~glsTileDataset()
- SourceId
- MaxZoom
- MinZoom
- TileFormat
glsTileDataSource
- glsTileDataSource
- ReadTile(glsTileKey, out glsTileFormat)
- Dispose()
- ~glsTileDataSource()
- TileSize
- ZoomLevel
지형 타일의 고도
고도 타일의 색 인코딩을 확인한 뒤 한 점 또는 경로의 고도를 조회하거나 사각형의 최고점을 찾습니다. 단일 밴드 수치 래스터 고도 조회는 C++ 주제 그룹에서 찾을 수 있습니다.
glsTerrainTileDataSource
- glsTerrainTileDataSource
- TryGetElevation(double, double, out double)
- ReadElevationProfile(double, double, double, double, int, out bool)
- TryFindMaximumElevation(glsEnvelope, out glsMapPoint, out double)
- Dispose()
- ~glsTerrainTileDataSource()
- TileSize
- ZoomLevel
- Encoding
- MaximumSearchTileLimit
벡터 타일의 스타일
벡터 타일 데이터셋의 활성 Mapbox Style v8 문서를 읽거나 서버에서 다시 내려받아 적용합니다.