Skip to content

Commit

Permalink
Validate projection is valid (#47)
Browse files Browse the repository at this point in the history
* Without validation, later code may be invalid

Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 authored Jan 17, 2024
1 parent 04b2560 commit 9674fdb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/grid_map_geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ bool GridMapGeo::initializeFromGeotiff(const std::string &path, bool align_terra
}

const char *pszProjection = dataset->GetProjectionRef();

if (strlen(pszProjection) == 0) {
// https://gdal.org/user/raster_data_model.html#coordinate-system
std::cerr << std::endl << "Wkt ProjectionRef is unknown!" << std::endl;
return false;
}

std::cout << std::endl << "Wkt ProjectionRef: " << pszProjection << std::endl;

// Get image metadata
Expand Down

0 comments on commit 9674fdb

Please sign in to comment.