Skip to content

Commit

Permalink
Merge pull request #3414 from OSGeo/backport-3413-to-9.1
Browse files Browse the repository at this point in the history
[Backport 9.1] C++ API: add methods to build Geographic/Vertical Offset conversions
  • Loading branch information
rouault committed Oct 25, 2022
2 parents 9e1b8ac + d1955db commit cfa1952
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 0 deletions.
17 changes: 17 additions & 0 deletions include/proj/coordinateoperation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,23 @@ class PROJ_GCC_DLL Conversion : public SingleOperation {
PROJ_DLL static ConversionNNPtr
createGeographicGeocentric(const util::PropertyMap &properties);

PROJ_DLL static ConversionNNPtr
createGeographic2DOffsets(const util::PropertyMap &properties,
const common::Angle &offsetLat,
const common::Angle &offsetLon);

PROJ_DLL static ConversionNNPtr createGeographic3DOffsets(
const util::PropertyMap &properties, const common::Angle &offsetLat,
const common::Angle &offsetLon, const common::Length &offsetHeight);

PROJ_DLL static ConversionNNPtr createGeographic2DWithHeightOffsets(
const util::PropertyMap &properties, const common::Angle &offsetLat,
const common::Angle &offsetLon, const common::Length &offsetHeight);

PROJ_DLL static ConversionNNPtr
createVerticalOffset(const util::PropertyMap &properties,
const common::Length &offsetHeight);

PROJ_DLL ConversionPtr convertToOtherMethod(int targetEPSGCode) const;

PROJ_PRIVATE :
Expand Down
4 changes: 4 additions & 0 deletions scripts/reference_exported_symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@ osgeo::proj::operation::Conversion::createEquidistantCylindrical(osgeo::proj::ut
osgeo::proj::operation::Conversion::createEquidistantCylindricalSpherical(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&)
osgeo::proj::operation::Conversion::createGall(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&)
osgeo::proj::operation::Conversion::createGaussSchreiberTransverseMercator(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Scale const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&)
osgeo::proj::operation::Conversion::createGeographic2DOffsets(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&)
osgeo::proj::operation::Conversion::createGeographic2DWithHeightOffsets(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&)
osgeo::proj::operation::Conversion::createGeographic3DOffsets(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&)
osgeo::proj::operation::Conversion::createGeographicGeocentric(osgeo::proj::util::PropertyMap const&)
osgeo::proj::operation::Conversion::createGeostationarySatelliteSweepX(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&)
osgeo::proj::operation::Conversion::createGeostationarySatelliteSweepY(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&)
Expand Down Expand Up @@ -591,6 +594,7 @@ osgeo::proj::operation::Conversion::createTunisiaMappingGrid(osgeo::proj::util::
osgeo::proj::operation::Conversion::createTwoPointEquidistant(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&)
osgeo::proj::operation::Conversion::createUTM(osgeo::proj::util::PropertyMap const&, int, bool)
osgeo::proj::operation::Conversion::createVanDerGrinten(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&)
osgeo::proj::operation::Conversion::createVerticalOffset(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Length const&)
osgeo::proj::operation::Conversion::createVerticalPerspective(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&)
osgeo::proj::operation::Conversion::createWagnerIII(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&)
osgeo::proj::operation::Conversion::createWagnerII(osgeo::proj::util::PropertyMap const&, osgeo::proj::common::Angle const&, osgeo::proj::common::Length const&, osgeo::proj::common::Length const&)
Expand Down
105 changes: 105 additions & 0 deletions src/iso19111/operation/conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4260,5 +4260,110 @@ ConversionNNPtr Conversion::identify() const {

// ---------------------------------------------------------------------------

/** \brief Instantiate a conversion with method Geographic 2D offsets
*
* This method is defined as [EPSG:9619]
* (https://www.epsg-registry.org/export.htm?gml=urn:ogc:def:method:EPSG::9619)
* *
* @param properties See \ref general_properties of the conversion.
* At minimum the name should be defined.
* @param offsetLat Latitude offset to add.
* @param offsetLon Longitude offset to add.
* @return new conversion.
*/
ConversionNNPtr
Conversion::createGeographic2DOffsets(const util::PropertyMap &properties,
const common::Angle &offsetLat,
const common::Angle &offsetLon) {
return create(
properties,
createMethodMapNameEPSGCode(EPSG_CODE_METHOD_GEOGRAPHIC2D_OFFSETS),
VectorOfParameters{
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_LATITUDE_OFFSET),
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_LONGITUDE_OFFSET)},
VectorOfValues{offsetLat, offsetLon});
}

// ---------------------------------------------------------------------------

/** \brief Instantiate a conversion with method Geographic 3D offsets
*
* This method is defined as [EPSG:9660]
* (https://www.epsg-registry.org/export.htm?gml=urn:ogc:def:method:EPSG::9660)
* *
* @param properties See \ref general_properties of the Conversion.
* At minimum the name should be defined.
* @param offsetLat Latitude offset to add.
* @param offsetLon Longitude offset to add.
* @param offsetHeight Height offset to add.
* @return new Conversion.
*/
ConversionNNPtr Conversion::createGeographic3DOffsets(
const util::PropertyMap &properties, const common::Angle &offsetLat,
const common::Angle &offsetLon, const common::Length &offsetHeight) {
return create(
properties,
createMethodMapNameEPSGCode(EPSG_CODE_METHOD_GEOGRAPHIC3D_OFFSETS),
VectorOfParameters{
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_LATITUDE_OFFSET),
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_LONGITUDE_OFFSET),
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_VERTICAL_OFFSET)},
VectorOfValues{offsetLat, offsetLon, offsetHeight});
}

// ---------------------------------------------------------------------------

/** \brief Instantiate a conversion with method Geographic 2D with
* height
* offsets
*
* This method is defined as [EPSG:9618]
* (https://www.epsg-registry.org/export.htm?gml=urn:ogc:def:method:EPSG::9618)
* *
* @param properties See \ref general_properties of the Conversion.
* At minimum the name should be defined.
* @param offsetLat Latitude offset to add.
* @param offsetLon Longitude offset to add.
* @param offsetHeight Geoid undulation to add.
* @return new Conversion.
*/
ConversionNNPtr Conversion::createGeographic2DWithHeightOffsets(
const util::PropertyMap &properties, const common::Angle &offsetLat,
const common::Angle &offsetLon, const common::Length &offsetHeight) {
return create(
properties,
createMethodMapNameEPSGCode(
EPSG_CODE_METHOD_GEOGRAPHIC2D_WITH_HEIGHT_OFFSETS),
VectorOfParameters{
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_LATITUDE_OFFSET),
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_LONGITUDE_OFFSET),
createOpParamNameEPSGCode(EPSG_CODE_PARAMETER_GEOID_UNDULATION)},
VectorOfValues{offsetLat, offsetLon, offsetHeight});
}

// ---------------------------------------------------------------------------

/** \brief Instantiate a conversion with method Vertical Offset.
*
* This method is defined as [EPSG:9616]
* (https://www.epsg-registry.org/export.htm?gml=urn:ogc:def:method:EPSG::9616)
* *
* @param properties See \ref general_properties of the Conversion.
* At minimum the name should be defined.
* @param offsetHeight Geoid undulation to add.
* @return new Conversion.
*/
ConversionNNPtr
Conversion::createVerticalOffset(const util::PropertyMap &properties,
const common::Length &offsetHeight) {
return create(properties,
createMethodMapNameEPSGCode(EPSG_CODE_METHOD_VERTICAL_OFFSET),
VectorOfParameters{createOpParamNameEPSGCode(
EPSG_CODE_PARAMETER_VERTICAL_OFFSET)},
VectorOfValues{offsetHeight});
}

// ---------------------------------------------------------------------------

} // namespace operation
NS_PROJ_END

0 comments on commit cfa1952

Please sign in to comment.