aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/c_api.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-09-03 11:55:24 +0200
committerGitHub <noreply@github.com>2021-09-03 11:55:24 +0200
commit27fb08a9c9127b413e21434fffa0d01486c04c16 (patch)
tree8df541ff8ea4c0597b571f3c8b7d2478cbf93bb4 /src/iso19111/c_api.cpp
parent3f018de8ec316056dfc26201c6870d66444777e8 (diff)
parentf19b2948efcb7433d41e51d5128c5baa68261599 (diff)
downloadPROJ-27fb08a9c9127b413e21434fffa0d01486c04c16.tar.gz
PROJ-27fb08a9c9127b413e21434fffa0d01486c04c16.zip
Merge pull request #2835 from rouault/netcdf_cf_pole_rotation
Add proj_create_conversion_pole_rotation_netcdf_cf_convention() to address netCDF datasets using a pole rotation method
Diffstat (limited to 'src/iso19111/c_api.cpp')
-rw-r--r--src/iso19111/c_api.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp
index ace699e4..1bf6cbf0 100644
--- a/src/iso19111/c_api.cpp
+++ b/src/iso19111/c_api.cpp
@@ -7085,6 +7085,37 @@ PJ *proj_create_conversion_pole_rotation_grib_convention(
return nullptr;
}
+// ---------------------------------------------------------------------------
+
+/** \brief Instantiate a conversion based on the Pole Rotation method, using
+ * the conventions of the netCDF CF convention for the netCDF format.
+ *
+ * See
+ * osgeo::proj::operation::Conversion::createPoleRotationNetCDFCFConvention().
+ *
+ * Linear parameters are expressed in (linear_unit_name,
+ * linear_unit_conv_factor).
+ * Angular parameters are expressed in (ang_unit_name, ang_unit_conv_factor).
+ */
+PJ *proj_create_conversion_pole_rotation_netcdf_cf_convention(
+ PJ_CONTEXT *ctx, double grid_north_pole_latitude,
+ double grid_north_pole_longitude, double north_pole_grid_longitude,
+ const char *ang_unit_name, double ang_unit_conv_factor) {
+ SANITIZE_CTX(ctx);
+ try {
+ UnitOfMeasure angUnit(
+ createAngularUnit(ang_unit_name, ang_unit_conv_factor));
+ auto conv = Conversion::createPoleRotationNetCDFCFConvention(
+ PropertyMap(), Angle(grid_north_pole_latitude, angUnit),
+ Angle(grid_north_pole_longitude, angUnit),
+ Angle(north_pole_grid_longitude, angUnit));
+ return proj_create_conversion(ctx, conv);
+ } catch (const std::exception &e) {
+ proj_log_error(ctx, __FUNCTION__, e.what());
+ }
+ return nullptr;
+}
+
/* END: Generated by scripts/create_c_api_projections.py*/
// ---------------------------------------------------------------------------