aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-09-04 14:33:39 +0200
committerEven Rouault <even.rouault@spatialys.com>2019-09-04 14:33:39 +0200
commit403e57545f1c95da55ec82b86613dc2645ca6a7b (patch)
tree68f70a7af33dc55b9faa3fd5c8b665a4b7fea3e2 /src
parentfaf7ec2d7f5d489bfd187f1a3408f0f09f94282f (diff)
downloadPROJ-403e57545f1c95da55ec82b86613dc2645ca6a7b.tar.gz
PROJ-403e57545f1c95da55ec82b86613dc2645ca6a7b.zip
C API: add proj_create_ellipsoidal_3D_cs()
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/c_api.cpp52
-rw-r--r--src/iso19111/coordinatesystem.cpp22
-rw-r--r--src/proj_experimental.h16
3 files changed, 90 insertions, 0 deletions
diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp
index 312daeab..1ae79fa3 100644
--- a/src/iso19111/c_api.cpp
+++ b/src/iso19111/c_api.cpp
@@ -3763,6 +3763,58 @@ PJ *proj_create_ellipsoidal_2D_cs(PJ_CONTEXT *ctx,
// ---------------------------------------------------------------------------
+/** \brief Instantiate a Ellipsoidal 3D
+ *
+ * The returned object must be unreferenced with proj_destroy() after
+ * use.
+ * It should be used by at most one thread at a time.
+ *
+ * @param ctx PROJ context, or NULL for default context
+ * @param type Coordinate system type.
+ * @param horizontal_angular_unit_name Horizontal angular unit name.
+ * @param horizontal_angular_unit_conv_factor Horizontal angular unit conversion
+ * factor to SI.
+ * @param vertical_linear_unit_name Vertical linear unit name.
+ * @param vertical_linear_unit_conv_factor Vertical linear unit conversion
+ * factor to SI.
+ *
+ * @return Object that must be unreferenced with
+ * proj_destroy(), or NULL in case of error.
+ * @since 7.0
+ */
+
+PJ *proj_create_ellipsoidal_3D_cs(PJ_CONTEXT *ctx,
+ PJ_ELLIPSOIDAL_CS_3D_TYPE type,
+ const char *horizontal_angular_unit_name,
+ double horizontal_angular_unit_conv_factor,
+ const char *vertical_linear_unit_name,
+ double vertical_linear_unit_conv_factor) {
+ try {
+ switch (type) {
+ case PJ_ELLPS3D_LONGITUDE_LATITUDE_HEIGHT:
+ return pj_obj_create(
+ ctx, EllipsoidalCS::createLongitudeLatitudeEllipsoidalHeight(
+ createAngularUnit(horizontal_angular_unit_name,
+ horizontal_angular_unit_conv_factor),
+ createLinearUnit(vertical_linear_unit_name,
+ vertical_linear_unit_conv_factor)));
+
+ case PJ_ELLPS3D_LATITUDE_LONGITUDE_HEIGHT:
+ return pj_obj_create(
+ ctx, EllipsoidalCS::createLatitudeLongitudeEllipsoidalHeight(
+ createAngularUnit(horizontal_angular_unit_name,
+ horizontal_angular_unit_conv_factor),
+ createLinearUnit(vertical_linear_unit_name,
+ vertical_linear_unit_conv_factor)));
+ }
+ } catch (const std::exception &e) {
+ proj_log_error(ctx, __FUNCTION__, e.what());
+ }
+ return nullptr;
+}
+
+// ---------------------------------------------------------------------------
+
/** \brief Instantiate a ProjectedCRS
*
* The returned object must be unreferenced with proj_destroy() after
diff --git a/src/iso19111/coordinatesystem.cpp b/src/iso19111/coordinatesystem.cpp
index 5a852b0d..c452da44 100644
--- a/src/iso19111/coordinatesystem.cpp
+++ b/src/iso19111/coordinatesystem.cpp
@@ -789,6 +789,28 @@ EllipsoidalCS::createLongitudeLatitude(const common::UnitOfMeasure &unit) {
// ---------------------------------------------------------------------------
+/** \brief Instantiate a EllipsoidalCS with a Longitude (first), Latitude
+ * (second) axis and ellipsoidal height (third) axis.
+ *
+ * @param angularUnit Angular unit of the latitude and longitude axes.
+ * @param linearUnit Linear unit of the ellipsoidal height axis.
+ * @return a new EllipsoidalCS.
+ * @since 7.0
+ */
+EllipsoidalCSNNPtr EllipsoidalCS::createLongitudeLatitudeEllipsoidalHeight(
+ const common::UnitOfMeasure &angularUnit,
+ const common::UnitOfMeasure &linearUnit) {
+ return EllipsoidalCS::create(
+ util::PropertyMap(), CoordinateSystemAxis::createLONG_EAST(angularUnit),
+ CoordinateSystemAxis::createLAT_NORTH(angularUnit),
+ CoordinateSystemAxis::create(
+ util::PropertyMap().set(IdentifiedObject::NAME_KEY,
+ AxisName::Ellipsoidal_height),
+ AxisAbbreviation::h, AxisDirection::UP, linearUnit));
+}
+
+// ---------------------------------------------------------------------------
+
//! @cond Doxygen_Suppress
/** \brief Return the axis order in an enumerated way. */
EllipsoidalCS::AxisOrder EllipsoidalCS::axisOrder() const {
diff --git a/src/proj_experimental.h b/src/proj_experimental.h
index 0e97ac9f..5a96203c 100644
--- a/src/proj_experimental.h
+++ b/src/proj_experimental.h
@@ -130,6 +130,22 @@ PJ PROJ_DLL *proj_create_ellipsoidal_2D_cs(PJ_CONTEXT *ctx,
const char* unit_name,
double unit_conv_factor);
+/** Type of Ellipsoidal 3D coordinate system. */
+typedef enum
+{
+ /* Longitude-Latitude-Height(up) */
+ PJ_ELLPS3D_LONGITUDE_LATITUDE_HEIGHT,
+ /* Latitude-Longitude-Height(up) */
+ PJ_ELLPS3D_LATITUDE_LONGITUDE_HEIGHT,
+} PJ_ELLIPSOIDAL_CS_3D_TYPE;
+
+PJ PROJ_DLL *proj_create_ellipsoidal_3D_cs(PJ_CONTEXT *ctx,
+ PJ_ELLIPSOIDAL_CS_3D_TYPE type,
+ const char* horizontal_angular_unit_name,
+ double horizontal_angular_unit_conv_factor,
+ const char* vertical_linear_unit_name,
+ double vertical_linear_unit_conv_factor);
+
PJ_OBJ_LIST PROJ_DLL *proj_query_geodetic_crs_from_datum(
PJ_CONTEXT *ctx,
const char *crs_auth_name,