aboutsummaryrefslogtreecommitdiff
path: root/src/pj_obs_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pj_obs_api.c')
-rw-r--r--src/pj_obs_api.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/src/pj_obs_api.c b/src/pj_obs_api.c
index 05fe58f0..b06f0823 100644
--- a/src/pj_obs_api.c
+++ b/src/pj_obs_api.c
@@ -37,7 +37,6 @@
#include "proj_internal.h"
#include "projects.h"
#include <geodesic.h>
-
#include <stddef.h>
#include <errno.h>
@@ -517,7 +516,56 @@ char *proj_definition_retrieve (PJ *P) {
return pj_get_def(P, 0);
}
-/* ...and get rid of it safely */
+
+/*****************************************************************************/
+PJ_DERIVS proj_derivatives(const PJ *P, const LP lp) {
+/******************************************************************************
+ Derivatives of coordinates.
+
+ returns PJ_DERIVS. If unsuccessfull error number is set and the returned
+ struct contains NULL data.
+
+******************************************************************************/
+ PJ_DERIVS derivs;
+
+ /* casting to struct DERIVS for compatibility reasons */
+ if (pj_deriv(lp, 1e-5, (PJ *)P, (struct DERIVS *)&derivs)) {
+ /* errno set in pj_derivs */
+ memset(&derivs, 0, sizeof(PJ_DERIVS));
+ }
+
+ return derivs;
+}
+
+
+/*****************************************************************************/
+PJ_FACTORS proj_factors(const PJ *P, const LP lp) {
+/******************************************************************************
+ Cartographic characteristics at point lp.
+
+ Characteristics include meridian, parallel and areal scales, angular
+ distortion, meridian/parallel, meridian convergence and scale error.
+
+ returns PJ_FACTORS. If unsuccessfull error number is set and the returned
+ struct contains NULL data.
+
+******************************************************************************/
+ PJ_FACTORS factors;
+
+ /* pj_factors rely code being zero */
+ factors.code = 0;
+
+ /* casting to struct FACTORS for compatibility reasons */
+ if (pj_factors(lp, (PJ *)P, 0.0, (struct FACTORS *)&factors)) {
+ /* errno set in pj_factors */
+ memset(&factors, 0, sizeof(PJ_FACTORS));
+ }
+
+ return factors;
+}
+
+
+/* Release, or free, memory that was retrieved by the above functions */
void *proj_release (void *buffer) {
return pj_dealloc (buffer);
}
@@ -537,3 +585,5 @@ double proj_dmstor(const char *is, char **rs) {
char* proj_rtodms(char *s, double r, int pos, int neg) {
return rtodms(s, r, pos, neg);
}
+
+