Skip to content

Commit 9674fdb

Browse files
authored
Validate projection is valid (#47)
* Without validation, later code may be invalid Signed-off-by: Ryan Friedman <[email protected]>
1 parent 04b2560 commit 9674fdb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/grid_map_geo.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ bool GridMapGeo::initializeFromGeotiff(const std::string &path, bool align_terra
7878
}
7979

8080
const char *pszProjection = dataset->GetProjectionRef();
81+
82+
if (strlen(pszProjection) == 0) {
83+
// https://gdal.org/user/raster_data_model.html#coordinate-system
84+
std::cerr << std::endl << "Wkt ProjectionRef is unknown!" << std::endl;
85+
return false;
86+
}
87+
8188
std::cout << std::endl << "Wkt ProjectionRef: " << pszProjection << std::endl;
8289

8390
// Get image metadata

0 commit comments

Comments
 (0)