diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-04-28 11:36:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-28 11:36:29 +0200 |
| commit | 3cd07b2194832ee341462e0e101902f6e0d64878 (patch) | |
| tree | 3379400feab55ad88aaa4bc0333e92d48a18213f /src/iso19111/io.cpp | |
| parent | 39cd68f661ac86484b341c93f949c29592694e89 (diff) | |
| download | PROJ-3cd07b2194832ee341462e0e101902f6e0d64878.tar.gz PROJ-3cd07b2194832ee341462e0e101902f6e0d64878.zip | |
createFromProjString(): handle default parameters of '+krovak +type=crs', and handle +czech correctly (fixes #2199) (#2200)
* createFromProjString(): handle default parameters of '+krovak +type=crs', and handle +czech correctly (fixes #2199)
* Doc: add default values for Krovak
Diffstat (limited to 'src/iso19111/io.cpp')
| -rw-r--r-- | src/iso19111/io.cpp | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 21754a44..a255b959 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -8089,7 +8089,7 @@ std::string PROJStringParser::Private::guessBodyName(double a) { GeodeticReferenceFrameNNPtr PROJStringParser::Private::buildDatum(Step &step, const std::string &title) { - const auto &ellpsStr = getParamValue(step, "ellps"); + std::string ellpsStr = getParamValue(step, "ellps"); const auto &datumStr = getParamValue(step, "datum"); const auto &RStr = getParamValue(step, "R"); const auto &aStr = getParamValue(step, "a"); @@ -8106,6 +8106,11 @@ PROJStringParser::Private::buildDatum(Step &step, const std::string &title) { !RStr.empty() || !aStr.empty() || !bStr.empty() || !rfStr.empty() || !fStr.empty() || !esStr.empty() || !eStr.empty(); + if (!numericParamPresent && ellpsStr.empty() && datumStr.empty() && + step.name == "krovak") { + ellpsStr = "bessel"; + } + PrimeMeridianNNPtr pm(buildPrimeMeridian(step)); PropertyMap grfMap; @@ -8504,6 +8509,9 @@ PROJStringParser::Private::processAxisSwap(Step &step, throw ParsingException("Unhandled order=" + orderStr); } } + } else if (step.name == "krovak" && hasParamValue(step, "czech")) { + axis[0] = west; + axis[1] = south; } return axis; } @@ -8841,9 +8849,14 @@ CRSNNPtr PROJStringParser::Private::buildProjectedCRS( Step::KeyValue("lonc", getParamValue(step, "lon_0"))); } } else if (step.name == "krovak" && - ((getParamValue(step, "axis") == "swu" && iAxisSwap < 0) || + ((iAxisSwap < 0 && getParamValue(step, "axis") == "swu" && + !hasParamValue(step, "czech")) || (iAxisSwap > 0 && - getParamValue(steps_[iAxisSwap], "order") == "-2,-1"))) { + getParamValue(steps_[iAxisSwap], "order") == "-2,-1" && + !hasParamValue(step, "czech")))) { + mapping = getMapping(EPSG_CODE_METHOD_KROVAK); + } else if (step.name == "krovak" && iAxisSwap < 0 && + hasParamValue(step, "czech") && !hasParamValue(step, "axis")) { mapping = getMapping(EPSG_CODE_METHOD_KROVAK); } else if (step.name == "merc") { if (hasParamValue(step, "a") && hasParamValue(step, "b") && @@ -8992,9 +9005,6 @@ CRSNNPtr PROJStringParser::Private::buildProjectedCRS( if (hasError) { throw ParsingException("invalid value for " + proj_name); } - - } else if (param->unit_type == UnitOfMeasure::Type::SCALE) { - value = 1; } // For omerc, if gamma is missing, the default value is // alpha @@ -9004,13 +9014,24 @@ CRSNNPtr PROJStringParser::Private::buildProjectedCRS( value = getAngularValue(*paramValue); } } else if (step.name == "krovak") { + // Keep it in sync with defaults of krovak.cpp if (param->epsg_code == - EPSG_CODE_PARAMETER_COLATITUDE_CONE_AXIS) { + EPSG_CODE_PARAMETER_LATITUDE_PROJECTION_CENTRE) { + value = 49.5; + } else if (param->epsg_code == + EPSG_CODE_PARAMETER_LONGITUDE_OF_ORIGIN) { + value = 24.833333333333333333; + } else if (param->epsg_code == + EPSG_CODE_PARAMETER_COLATITUDE_CONE_AXIS) { value = 30.28813975277777776; } else if ( param->epsg_code == EPSG_CODE_PARAMETER_LATITUDE_PSEUDO_STANDARD_PARALLEL) { value = 78.5; + } else if ( + param->epsg_code == + EPSG_CODE_PARAMETER_SCALE_FACTOR_PSEUDO_STANDARD_PARALLEL) { + value = 0.9999; } } else if (step.name == "cea" && proj_name == "lat_ts") { paramValue = &getParamValueK(step); @@ -9034,6 +9055,8 @@ CRSNNPtr PROJStringParser::Private::buildProjectedCRS( throw ParsingException("k/k_0 should be in [0,1]"); } } + } else if (param->unit_type == UnitOfMeasure::Type::SCALE) { + value = 1; } PropertyMap propertiesParameter; |
