@@ -108,7 +108,8 @@ bool writeGeoTiffFloat(const std::string &filename, int x, int y, const float *d
108108 return false ;
109109 }
110110 // the set of keys in the key-value pairs that we are parsing
111- const std::vector<std::string> keys = { " +proj" , " +ellps" , " +datum" , " +units" , " +lat_0" , " +lon_0" , " +x_0" , " +y_0" , " +zone" };
111+ const std::vector<std::string> keys = { " +proj" , " +ellps" , " +datum" , " +units" , " +lat_0" , " +lon_0" , " +x_0" , " +y_0" , " +zone" , " +south" };
112+ bool is_south = false ;
112113 std::vector<std::string> values;
113114 int zone_value = KvUserDefined;
114115 for (const auto &key : keys)
@@ -133,6 +134,11 @@ bool writeGeoTiffFloat(const std::string &filename, int x, int y, const float *d
133134 }
134135 // generate the list of values that correspond to the list of keys
135136 found += key.length () + 1 ;
137+ if (key == " +south" )
138+ {
139+ is_south = true ;
140+ continue ; // don't need to set any value
141+ }
136142 std::string::size_type space = line.find (" " , found);
137143 if (space == std::string::npos)
138144 space = line.length ();
@@ -167,6 +173,7 @@ bool writeGeoTiffFloat(const std::string &filename, int x, int y, const float *d
167173 zone_value = std::stoi (values[8 ]);
168174 std::cout << " zone?: " << zone_value << std::endl;
169175 }
176+
170177 std::cout << " proj: " << values[0 ] << " , geooffset: " << geo_offset.transpose () << " , geokey: " << values[1 ] << " , datum: " << values[2 ]
171178 << " , coord_long: " << coord_long << " zone: " << zone_value << std::endl;
172179
@@ -201,6 +208,12 @@ bool writeGeoTiffFloat(const std::string &filename, int x, int y, const float *d
201208 return false ;
202209 }
203210 }
211+ if (is_south)
212+ {
213+ GTIFKeySet (gtif, ProjFalseNorthingGeoKey, TYPE_DOUBLE, 1 , 10000000.0 ); // false northing
214+ // Usually paired with the Latitude of Natural Origin (Equator)
215+ GTIFKeySet (gtif, ProjNatOriginLatGeoKey, TYPE_DOUBLE, 1 , 0.0 );
216+ }
204217
205218 // describe the coordinates of the image corners
206219 const double tiepoints[6 ] = { 0 , 0 , 0 , origin_x + geo_offset[0 ], origin_y + geo_offset[1 ], 0 };
0 commit comments