2020-10-01 18:59:18 +08:00
|
|
|
// Copyright 2020 Google LLC
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2020-10-14 04:03:04 +08:00
|
|
|
#ifndef RASTER_TO_GTIFF_GET_RASTER_DATA_H_
|
|
|
|
#define RASTER_TO_GTIFF_GET_RASTER_DATA_H_
|
2020-10-01 18:59:18 +08:00
|
|
|
|
|
|
|
#include <optional>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2020-10-14 04:03:04 +08:00
|
|
|
namespace gdal::sandbox::parser {
|
2020-10-01 18:59:18 +08:00
|
|
|
|
|
|
|
struct RasterBandData {
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
std::vector<int> data;
|
2020-10-19 23:08:03 +08:00
|
|
|
int data_type; // Corresponds to the GDALDataType enum
|
2020-10-06 02:01:15 +08:00
|
|
|
int color_interp; // Corresponds to the GDALColorInterp enum
|
2020-10-01 18:59:18 +08:00
|
|
|
std::optional<double> no_data_value;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RasterDataset {
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
std::vector<RasterBandData> bands;
|
|
|
|
std::string wkt_projection; // OpenGIS WKT format
|
|
|
|
std::vector<double> geo_transform;
|
|
|
|
};
|
|
|
|
|
|
|
|
RasterDataset GetRasterBandsFromFile(const std::string& filename);
|
|
|
|
bool operator==(const RasterBandData& lhs, const RasterBandData& rhs);
|
|
|
|
bool operator==(const RasterDataset& lhs, const RasterDataset& rhs);
|
|
|
|
|
2020-10-14 04:03:04 +08:00
|
|
|
} // namespace gdal::sandbox::parser
|
2020-10-01 18:59:18 +08:00
|
|
|
|
2020-10-14 04:03:04 +08:00
|
|
|
#endif // RASTER_TO_GTIFF_GET_RASTER_DATA_H_
|