8 # include <vcl_msvc_warnings.h> 10 #include <geo_tiffp.h> 11 #include <geotiffio.h> 12 #include <geovalues.h> 19 GTIFPrint(
gtif_,
nullptr,
nullptr);
33 double* points=
nullptr;
35 if (TIFFGetField(
tif_, GTIFF_TIEPOINTS, &count, &points) < 0)
43 assert((count % 6) == 0);
44 for (
unsigned short i=0; i<count; ) {
45 std::vector<double> tiepoint(6);
46 tiepoint[0] = points[i++];
47 tiepoint[1] = points[i++];
48 tiepoint[2] = points[i++];
49 tiepoint[3] = points[i++];
50 tiepoint[4] = points[i++];
51 tiepoint[5] = points[i++];
52 tiepoints.push_back(tiepoint);
61 if (TIFFGetField(
tif_, GTIFF_PIXELSCALE, &count, &data )) {
75 if (TIFFGetField(
tif_, GTIFF_TRANSMATRIX, &count, &trans_matrix )) {
86 if (!GTIFKeyGet(
gtif_, GTModelTypeGeoKey, &model, 0, 1)) {
87 std::cerr <<
"NO Model Type defined!!!!\n";
91 type = static_cast<modeltype_t> (model);
99 if (!GTIFKeyGet(
gtif_, GTRasterTypeGeoKey, &raster, 0, 1)) {
100 std::cerr <<
"NO Raster Type, failure!!!!\n";
104 type = static_cast<rastertype_t> (raster);
111 short nGeogUOMLinear;
112 if (!GTIFKeyGet(
gtif_, GeogLinearUnitsGeoKey, &nGeogUOMLinear, 0, 1 )) {
113 std::cerr <<
"NO GEOUNITS, failure!!!!\n";
117 units = static_cast<geounits_t> (nGeogUOMLinear);
131 bool status =
get_key_value(ProjectedCSTypeGeoKey, &value, size, length, ttype);
133 std::cerr <<
"Missing ProjectedCSTypeGeoKey (" << ProjectedCSTypeGeoKey <<
") key!\n";
140 if(length != 1 || ttype != TYPE_SHORT) {
141 std::cerr <<
"Expected a single value with type int16 (short)!\n";
145 auto *val = static_cast<short*> (value);
146 if ((*val < PCS_WGS84_UTM_zone_1N ) || ((*val > PCS_WGS84_UTM_zone_60S ))) {
154 if ((*val >= PCS_WGS84_UTM_zone_1N) && (*val <= PCS_WGS84_UTM_zone_60N)) {
158 else if ((*val >= PCS_WGS84_UTM_zone_1S) && (*val <= PCS_WGS84_UTM_zone_60S)) {
175 void *value;
int size;
int length; tagtype_t ttype;
177 bool status =
get_key_value(GeogLinearUnitsGeoKey, &value, size, length, ttype);
179 std::cerr <<
"Missing GeogLinearUnitsGeoKey (" << GeogLinearUnitsGeoKey <<
") key!\n";
182 if(length != 1 || ttype != TYPE_SHORT) {
183 std::cerr <<
"Expected a single value with type int16 (short)!\n";
186 auto *val = static_cast<short*> (value);
188 if (*val != Linear_Meter) {
189 std::cerr <<
"Linear units are not in Meters!\n";
193 status =
get_key_value(GeogAngularUnitsGeoKey, &value, size, length, ttype);
195 std::cerr <<
"Missing GeogAngularUnitsGeoKey (" << GeogAngularUnitsGeoKey <<
") key!\n";
198 if(length != 1 || ttype != TYPE_SHORT) {
199 std::cerr <<
"Expected a single value with type int16 (short)!\n";
202 val = static_cast<short*> (value);
204 if (*val != Angular_Degree) {
205 std::cerr <<
"Angular units are not in Degrees!\n";
224 bool status =
get_key_value(ProjectedCSTypeGeoKey, &value, size, length, ttype);
226 std::cerr <<
"Missing ProjectedCSTypeGeoKey (" << ProjectedCSTypeGeoKey <<
") key!\n";
229 if(length != 1 || ttype != TYPE_SHORT) {
230 std::cerr <<
"Expected a single value with type int16 (short)!\n";
234 auto *val = static_cast<short*> (value);
235 if ((*val < PCS_NAD83_UTM_zone_3N ) || ((*val > PCS_NAD83_Missouri_West ))) {
236 std::cerr <<
"NOT in RANGE PCS_NAD83_UTM_zone_3N and PCS_NAD83_Missouri_West!\n";
252 int& size,
int& length, tagtype_t& type)
254 length = GTIFKeyInfo(
gtif_, key, &size, &type);
259 std::cerr <<
"KeyID=" << (
short int)key <<
" is not valid\n";
263 *value = std::malloc(size*length);
264 GTIFKeyGet(
gtif_, key, *value, 0, length);