| 14423 | } |
| 14424 | |
| 14425 | void CRScheck::check(std::string& description) { |
| 14426 | if (lasheader->vlr_geo_keys || lasheader->vlr_geo_ogc_wkt) |
| 14427 | { |
| 14428 | LASMessage(LAS_VERBOSE, "start with the CRS validation"); |
| 14429 | |
| 14430 | if (lasheader->vlr_geo_keys) |
| 14431 | { |
| 14432 | if (!check_geokeys(description)) |
| 14433 | { |
| 14434 | set_oss_content(note_oss, "geokey", (lasheader->vlr_geo_keys->number_of_keys > 1 ? "s" : ""), " do not define a CRS"); |
| 14435 | if (no_CRS_fail) |
| 14436 | { |
| 14437 | results.add_warning("CRS", note_oss.str()); |
| 14438 | } |
| 14439 | else |
| 14440 | { |
| 14441 | results.add_fail("CRS", note_oss.str()); |
| 14442 | } |
| 14443 | } else if ((projections[0]) && (projections[0]->type == crs::CRS_PROJECTION_NONE)) { |
| 14444 | if ((lasheader->vlr_geo_ogc_wkt) && (lasheader->vlr_geo_ogc_wkt != lasheader->file_signature)) |
| 14445 | { |
| 14446 | set_oss_content(note_oss, lasheader->vlr_geo_keys->number_of_keys, " geokey", (lasheader->vlr_geo_keys->number_of_keys > 1 ? "s" : ""), |
| 14447 | " claim no CRS, but non-empty OGC WKT specify one"); |
| 14448 | if (no_CRS_fail) |
| 14449 | { |
| 14450 | results.add_warning("CRS", note_oss.str()); |
| 14451 | } |
| 14452 | else |
| 14453 | { |
| 14454 | results.add_fail("CRS", note_oss.str()); |
| 14455 | } |
| 14456 | } |
| 14457 | else |
| 14458 | { |
| 14459 | set_oss_content(note_oss, "CRS intentionally not specified (according to ", lasheader->vlr_geo_keys->number_of_keys, " geokey", |
| 14460 | (lasheader->vlr_geo_keys->number_of_keys > 1 ? "s" : "")); |
| 14461 | results.add_warning("CRS", note_oss.str()); |
| 14462 | } |
| 14463 | } |
| 14464 | } |
| 14465 | if (lasheader->vlr_geo_ogc_wkt) { |
| 14466 | if (lasheader->vlr_geo_ogc_wkt == lasheader->file_signature) { |
| 14467 | if ((projections[0]) && (projections[0]->type != crs::CRS_PROJECTION_NONE)) { |
| 14468 | set_oss_content(note_oss, "GEOTIFF tags define CRS, but OGC WKT claims non"); |
| 14469 | if (no_CRS_fail) { |
| 14470 | results.add_warning("CRS", note_oss.str()); |
| 14471 | } else { |
| 14472 | results.add_fail("CRS", note_oss.str()); |
| 14473 | } |
| 14474 | } else { |
| 14475 | set_oss_content(note_oss, "CRS intentionally not specified; empty OGC WKT"); |
| 14476 | results.add_warning("CRS", note_oss.str()); |
| 14477 | } |
| 14478 | } else if (geoprojectionconverter != nullptr && load_proj_library(nullptr, false) == true) { |
| 14479 | // try to use proj lib if loadable |
| 14480 | if (geoprojectionconverter->is_proj_wkt_valid(lasheader->vlr_geo_ogc_wkt) == false) { |
| 14481 | set_oss_content(note_oss, "invalid OGC WKT: CRS not valid"); |
| 14482 | if (no_CRS_fail) { |
no test coverage detected