@cond Doxygen_Suppress
| 9971 | |
| 9972 | //! @cond Doxygen_Suppress |
| 9973 | std::list<crs::ProjectedCRSNNPtr> |
| 9974 | AuthorityFactory::createProjectedCRSFromExisting( |
| 9975 | const crs::ProjectedCRSNNPtr &crs) const { |
| 9976 | std::list<crs::ProjectedCRSNNPtr> res; |
| 9977 | |
| 9978 | const auto &conv = crs->derivingConversionRef(); |
| 9979 | const auto &method = conv->method(); |
| 9980 | const auto methodEPSGCode = method->getEPSGCode(); |
| 9981 | if (methodEPSGCode == 0) { |
| 9982 | return res; |
| 9983 | } |
| 9984 | |
| 9985 | auto lockedThisFactory(d->getSharedFromThis()); |
| 9986 | assert(lockedThisFactory); |
| 9987 | const auto &baseCRS(crs->baseCRS()); |
| 9988 | auto candidatesGeodCRS = baseCRS->crs::CRS::identify(lockedThisFactory); |
| 9989 | auto geogCRS = dynamic_cast<const crs::GeographicCRS *>(baseCRS.get()); |
| 9990 | if (geogCRS) { |
| 9991 | const auto axisOrder = geogCRS->coordinateSystem()->axisOrder(); |
| 9992 | if (axisOrder == cs::EllipsoidalCS::AxisOrder::LONG_EAST_LAT_NORTH || |
| 9993 | axisOrder == cs::EllipsoidalCS::AxisOrder::LAT_NORTH_LONG_EAST) { |
| 9994 | const auto &unit = |
| 9995 | geogCRS->coordinateSystem()->axisList()[0]->unit(); |
| 9996 | auto otherOrderGeogCRS = crs::GeographicCRS::create( |
| 9997 | util::PropertyMap().set(common::IdentifiedObject::NAME_KEY, |
| 9998 | geogCRS->nameStr()), |
| 9999 | geogCRS->datum(), geogCRS->datumEnsemble(), |
| 10000 | axisOrder == cs::EllipsoidalCS::AxisOrder::LONG_EAST_LAT_NORTH |
| 10001 | ? cs::EllipsoidalCS::createLatitudeLongitude(unit) |
| 10002 | : cs::EllipsoidalCS::createLongitudeLatitude(unit)); |
| 10003 | auto otherCandidatesGeodCRS = |
| 10004 | otherOrderGeogCRS->crs::CRS::identify(lockedThisFactory); |
| 10005 | candidatesGeodCRS.insert(candidatesGeodCRS.end(), |
| 10006 | otherCandidatesGeodCRS.begin(), |
| 10007 | otherCandidatesGeodCRS.end()); |
| 10008 | } |
| 10009 | } |
| 10010 | |
| 10011 | std::string sql( |
| 10012 | "SELECT projected_crs.auth_name, projected_crs.code, " |
| 10013 | "projected_crs.name FROM projected_crs " |
| 10014 | "JOIN conversion_table conv ON " |
| 10015 | "projected_crs.conversion_auth_name = conv.auth_name AND " |
| 10016 | "projected_crs.conversion_code = conv.code " |
| 10017 | "JOIN geodetic_crs gcrs ON " |
| 10018 | "gcrs.auth_name = projected_crs.geodetic_crs_auth_name AND " |
| 10019 | "gcrs.code = projected_crs.geodetic_crs_code " |
| 10020 | "JOIN geodetic_datum datum ON " |
| 10021 | "datum.auth_name = gcrs.datum_auth_name AND " |
| 10022 | "datum.code = gcrs.datum_code " |
| 10023 | "JOIN ellipsoid ellps ON " |
| 10024 | "ellps.auth_name = datum.ellipsoid_auth_name AND " |
| 10025 | "ellps.code = datum.ellipsoid_code " |
| 10026 | "WHERE " |
| 10027 | "abs(ellps.semi_major_axis - ?) <= 1e-4 * ellps.semi_major_axis AND " |
| 10028 | "projected_crs.deprecated = 0 AND "); |
| 10029 | ListOfParams params; |
| 10030 | params.emplace_back( |
no test coverage detected