isce3 0.25.0
Loading...
Searching...
No Matches
Dataset.h
1#pragma once
2
3#include "forward.h"
4
5#include <gdal_priv.h>
6#include <memory>
7#include <string>
8
9#include <isce3/core/Projections.h>
10#include <isce3/io/IH5.h>
11
12#include "GeoTransform.h"
13
14namespace isce3 { namespace io { namespace gdal {
15
17class Dataset {
18public:
19
21 static
22 std::string defaultDriver() { return "ENVI"; }
23
30 Dataset(const std::string & path, GDALAccess access = GA_ReadOnly);
31
40 Dataset(const isce3::io::IDataSet & dataset, GDALAccess access = GA_ReadOnly);
41
52 Dataset(const std::string & path,
53 int width,
54 int length,
55 int bands,
56 GDALDataType datatype,
57 const std::string & driver = defaultDriver());
58
67 Dataset(const std::string & path, const Dataset & src);
68
76 Dataset(const std::string & path, const Dataset & src, const std::string & driver);
77
88 template<typename T>
89 Dataset(const T * data, int width, int length, int bands);
90
102 template<typename T>
103 Dataset(T * data, int width, int length, int bands, GDALAccess access = GA_Update);
104
116 template<typename T>
117 Dataset(const T * data,
118 int width,
119 int length,
120 int bands,
121 std::size_t colstride,
122 std::size_t rowstride,
123 std::size_t bandstride);
124
137 template<typename T>
138 Dataset(T * data,
139 int width,
140 int length,
141 int bands,
142 std::size_t colstride,
143 std::size_t rowstride,
144 std::size_t bandstride,
145 GDALAccess access = GA_Update);
146
148 GDALAccess access() const { return _access; }
149
151 int width() const { return _dataset->GetRasterXSize(); }
152
154 int length() const { return _dataset->GetRasterYSize(); }
155
157 int bands() const { return _dataset->GetRasterCount(); }
158
160 std::string driver() const { return _dataset->GetDriverName(); }
161
167 Raster getRaster(int band) const;
168
176
182 void setGeoTransform(const GeoTransform &);
183
190
197
199 double x0() const { return getGeoTransform().x0; }
200
202 double y0() const { return getGeoTransform().y0; }
203
205 double dx() const { return getGeoTransform().dx; }
206
208 double dy() const { return getGeoTransform().dy; }
209
211 GDALDataset * get() { return _dataset.get(); }
212
214 const GDALDataset * get() const { return _dataset.get(); }
215
216 friend class Raster;
217
218private:
219 std::shared_ptr<GDALDataset> _dataset;
220
221 // XXX need to keep track of access mode ourselves rather than use `_dataset->GetAccess()`
222 // XXX GDAL silently ignores the requested access mode when using "MEM" driver
223 // XXX and sets access mode to GA_Update (https://github.com/OSGeo/gdal/issues/1971)
224 GDALAccess _access;
225};
226
227}}}
228
229#define ISCE_IO_GDAL_DATASET_ICC
230#include "Dataset.icc"
231#undef ISCE_IO_GDAL_DATASET_ICC
Abstract base class for individual projections.
Definition Projections.h:21
Our derived dataset structure that includes utility functions.
Definition IH5.h:41
Wrapper for GDALDataset representing a collection of associated Raster bands.
Definition Dataset.h:17
void setProjection(const isce3::core::ProjectionBase *)
Set spatial reference system.
Definition Dataset.cpp:185
GDALDataset * get()
Get the underlying GDALDataset pointer.
Definition Dataset.h:211
GeoTransform getGeoTransform() const
Get transform from raster coordinates (pixel, line) to projected coordinates (x, y)
Definition Dataset.cpp:149
int length() const
Number of rows.
Definition Dataset.h:154
int bands() const
Number of bands.
Definition Dataset.h:157
isce3::core::ProjectionBase * getProjection() const
Get spatial reference system.
Definition Dataset.cpp:169
Raster getRaster(int band) const
Fetch raster band.
Definition Dataset.cpp:138
int width() const
Number of columns.
Definition Dataset.h:151
Dataset(const std::string &path, GDALAccess access=GA_ReadOnly)
Open an existing file as a GDAL dataset.
Definition Dataset.cpp:105
double x0() const
Left edge of left-most pixel in projection coordinates.
Definition Dataset.h:199
GDALAccess access() const
Access mode.
Definition Dataset.h:148
double y0() const
Upper edge of upper-most line in projection coordinates.
Definition Dataset.h:202
static std::string defaultDriver()
Default GDAL driver for dataset creation.
Definition Dataset.h:22
void setGeoTransform(const GeoTransform &)
Set geotransform.
Definition Dataset.cpp:156
const GDALDataset * get() const
Get the underlying GDALDataset pointer.
Definition Dataset.h:214
std::string driver() const
Driver name.
Definition Dataset.h:160
double dy() const
Line height in projection coordinates.
Definition Dataset.h:208
double dx() const
Pixel width in projection coordinates.
Definition Dataset.h:205
Wrapper for GDALRasterBand representing a single raster.
Definition Raster.h:14
The isce3::io namespace.
Definition Constants.h:14
base interpolator is an abstract base class
Definition BinarySearchFunc.cpp:5
Transform coefficients for transforming from (pixel, line) coordinates in raster space to (x,...
Definition GeoTransform.h:15

Generated for ISCE3.0 by doxygen 1.13.2.