31 #ifndef DRAIN_FILE_GEO_TIFF
32 #define DRAIN_FILE_GEO_TIFF
36 #ifndef USE_GEOTIFF_NO
39 #include <geotiffio.h>
40 #include <geo_normalize.h>
42 #include "drain/util/Flags.h"
44 #include "TreeXML-GDAL.h"
72 FileGeoTIFF(
const std::string & path,
const std::string & mode =
"w") :
FileTIFF(), gtif(
nullptr){
86 void open(
const std::string & path,
const std::string & mode =
"w");
90 void setGeoTiffField(geokey_t tag, T value){
91 if ((std::is_enum<T>::value) || (std::is_integral<T>::value)){
92 GTIFKeySet(gtif, tag, TYPE_SHORT, 1,
static_cast<short int>(value));
94 else if (std::is_floating_point<T>::value){
95 GTIFKeySet(gtif, tag, TYPE_FLOAT, 1, value);
99 mout.
warn(
"TAG: ", tag,
", value:", value,
", type=",
typeid(T).name());
100 mout.
error(
"Not implemented");
115 return FileTIFF::isOpen() && (gtif !=
nullptr);
131 complianceFlagger compliancyFlagger;
134 std::string compliancy;
153 void setGdal(
const std::string & key,
const T & value,
int sample=-1,
const std::string & role =
""){
172 item.set(
"sample", sample);
244 void FileGeoTIFF::setGeoTiffField(geokey_t tag,
const char *value){
245 GTIFKeySet(gtif, tag, TYPE_ASCII, strlen(value)+1, value);
250 void FileGeoTIFF::setGeoTiffField(geokey_t tag,
const std::string & value){
251 GTIFKeySet(gtif, tag, TYPE_ASCII, value.size()+1, value.c_str());
Flagger accepting values of enum type E.
Definition: Flags.h:763
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition: Log.h:308
Logger & error(const TT &... args)
Echoes.
Definition: Log.h:412
Logger & warn(const TT &... args)
Possible error, but execution can continue.
Definition: Log.h:426
Definition: FileGeoTIFF.h:61
TiffCompliance
Require strict GeoTIFF compliance.
Definition: FileGeoTIFF.h:125
void setGdalScale(double scale=1.0, double offset=0.0)
Definition: FileGeoTIFF.cpp:247
void setGdalNoData(const std::string &nodata)
This is between Tiff and GeoTiff?
Definition: FileGeoTIFF.cpp:257
void setGeoMetaData(const drain::image::GeoFrame &frame)
Sets projection and bounding box. Adjusts spatial resolution accordingly.
Definition: FileGeoTIFF.cpp:290
virtual void open(const std::string &path, const std::string &mode="w")
Opens a GeoTIFF file.
Definition: FileGeoTIFF.cpp:163
void setProjectionLongLat()
Sets projection to plain longitude-latitude mapping.
Definition: FileGeoTIFF.cpp:482
void setProjectionEPSG(short epsg)
Set projection using EPSG code. This is the recommended way.
Definition: FileGeoTIFF.cpp:422
TreeGDAL gdalMetadata
Use EPSG specific support only, if found. Else use also fromProj4Str().
Definition: FileGeoTIFF.h:139
void writeMetadata()
Completes GeoTIFF structure.
Definition: FileGeoTIFF.cpp:197
virtual bool isOpen() const
Todo: subclass.
Definition: FileGeoTIFF.h:114
void setProjection(const std::string &proj)
Sets projection given in Proj.4 string format.
Definition: FileGeoTIFF.cpp:359
For writing images in basic TIFF format. Reading not supported currently.
Definition: FileTIFF.h:58
Array with georeferencing support.
Definition: GeoFrame.h:58
Definition: TreeXML-GDAL.h:59
Definition: DataSelector.cpp:1277