Skip to content

Commit

Permalink
Fix error for valid edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelKutzner committed Dec 23, 2024
1 parent 1615277 commit c10af84
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/preprocessing/elevation/hgt_raster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ struct grid_point {
lat_dir);
utl::verify(lng_dir == 'W' || lng_dir == 'E', "Invalid direction '{}'",
lng_dir);
utl::verify(-180 <= lng && lng < 180, "Invalid longitude '{}'", lng);
utl::verify(-90 <= lat && lat < 90, "Invalid latitude '{}'", lat);
utl::verify(-180 <= lng && lng <= 180, "Invalid longitude '{}'", lng);
utl::verify(-90 <= lat && lat <= 90, "Invalid latitude '{}'", lat);

lat_ = static_cast<std::int8_t>((lat_dir == 'N') ? lat : -lat);
lng_ = static_cast<std::int16_t>((lng_dir == 'E') ? lng : -lng);

utl::verify(-180 <= lng_ && lng_ < 180, "Invalid longitude '{}'", lng);
utl::verify(-90 <= lat_ && lat_ < 90, "Invalid latitude '{}'", lat);
}

std::int8_t lat_;
Expand Down

0 comments on commit c10af84

Please sign in to comment.