aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/PJ_cart.c4
-rw-r--r--src/pj_obs_api.c15
-rw-r--r--src/proj.h12
-rw-r--r--src/projects.h6
4 files changed, 31 insertions, 6 deletions
diff --git a/src/PJ_cart.c b/src/PJ_cart.c
index 914fa94b..37aa3b97 100644
--- a/src/PJ_cart.c
+++ b/src/PJ_cart.c
@@ -457,7 +457,7 @@ int pj_cart_selftest (void) {
proj_destroy (P);
/* test proj_create_crs_to_crs() */
- P = proj_create_crs_to_crs(PJ_DEFAULT_CTX, "epsg:25832", "epsg:25833");
+ P = proj_create_crs_to_crs(PJ_DEFAULT_CTX, "epsg:25832", "epsg:25833", NULL);
if (P==0)
return 50;
@@ -472,7 +472,7 @@ int pj_cart_selftest (void) {
proj_destroy(P);
/* let's make sure that only entries in init-files results in a usable PJ */
- P = proj_create_crs_to_crs(PJ_DEFAULT_CTX, "proj=utm +zone=32 +datum=WGS84", "proj=utm +zone=33 +datum=WGS84");
+ P = proj_create_crs_to_crs(PJ_DEFAULT_CTX, "proj=utm +zone=32 +datum=WGS84", "proj=utm +zone=33 +datum=WGS84", NULL);
if (P != 0) {
proj_destroy(P);
return 52;
diff --git a/src/pj_obs_api.c b/src/pj_obs_api.c
index 9f699fcf..55da9fa2 100644
--- a/src/pj_obs_api.c
+++ b/src/pj_obs_api.c
@@ -388,13 +388,13 @@ PJ *proj_create_argv (PJ_CONTEXT *ctx, int argc, char **argv) {
}
/*****************************************************************************/
-PJ *proj_create_crs_to_crs (PJ_CONTEXT *ctx, const char *srid_from, const char *srid_to) {
+PJ *proj_create_crs_to_crs (PJ_CONTEXT *ctx, const char *srid_from, const char *srid_to, PJ_AREA *area) {
/******************************************************************************
Create a transformation pipeline between two known coordinate reference
systems.
srid_from and srid_to should be the value part of a +init=... parameter
- set, i.e. "epsg:25833" or "IGNF:AMST63". Any projection definition that is
+ set, i.e. "epsg:25833" or "IGNF:AMST63". Any projection definition that
can be found in a init-file in PROJ_LIB is a valid input to this function.
For now the function mimics the cs2cs app: An input and an output CRS is
@@ -403,14 +403,23 @@ PJ *proj_create_crs_to_crs (PJ_CONTEXT *ctx, const char *srid_from, const char
function can be extended to support "late-binding" transformations in the
future without affecting users of the function.
+ An "area of use" can be specified in area. In the current version of this
+ function is has no function, but is added in anticipation of a
+ "late-binding" implementation in the future. The idea being, that if a user
+ supplies an area of use, the more accurate transformation between two given
+ systems can be chosen.
+
Example call:
- PJ *P = proj_create_crs_to_crs(0, "epsg:25832", "epsg:25833");
+ PJ *P = proj_create_crs_to_crs(0, "epsg:25832", "epsg:25833", NULL);
******************************************************************************/
PJ *P;
char buffer[512];
+ /* area not in use yet, suppressing warning */
+ (void)area;
+
strcpy(buffer, "+proj=pipeline +step +init=");
strncat(buffer, srid_from, 512-strlen(buffer));
strncat(buffer, " +inv +step +init=", 512-strlen(buffer));
diff --git a/src/proj.h b/src/proj.h
index 3af1584c..aa9f3b17 100644
--- a/src/proj.h
+++ b/src/proj.h
@@ -182,6 +182,9 @@ typedef union PJ_TRIPLET PJ_TRIPLET;
union PJ_COORD;
typedef union PJ_COORD PJ_COORD;
+struct PJ_AREA;
+typedef struct PJ_AREA PJ_AREA;
+
struct DERIVS;
typedef struct DERIVS PJ_DERIVS;
@@ -295,6 +298,7 @@ union PJ_PAIR {
double v[2]; /* Yes - It's really just a vector! */
};
+
struct PJ_OBS {
PJ_COORD coo; /* coordinate data */
PJ_TRIPLET anc; /* ancillary data */
@@ -302,6 +306,7 @@ struct PJ_OBS {
unsigned int flags; /* additional data, intended for flags */
};
+
#define PJ_IS_ANAL_XL_YL 01 /* derivatives of lon analytic */
#define PJ_IS_ANAL_XP_YP 02 /* derivatives of lat analytic */
#define PJ_IS_ANAL_HK 04 /* h and k analytic */
@@ -363,9 +368,14 @@ PJ_CONTEXT *proj_context_destroy (PJ_CONTEXT *ctx);
/* Manage the transformation definition object PJ */
PJ *proj_create (PJ_CONTEXT *ctx, const char *definition);
PJ *proj_create_argv (PJ_CONTEXT *ctx, int argc, char **argv);
-PJ *proj_create_crs_to_crs(PJ_CONTEXT *ctx, const char *srid_from, const char *srid_to);
+PJ *proj_create_crs_to_crs(PJ_CONTEXT *ctx, const char *srid_from, const char *srid_to, PJ_AREA *area);
PJ *proj_destroy (PJ *P);
+/* Setter-functions for the opaque PJ_AREA struct */
+/* Uncomment these when implementing support for area-based transformations.
+void proj_area_bbox(PJ_AREA *area, LP ll, LP ur);
+void proj_area_description(PJ_AREA *area, const char *descr);
+*/
/* Apply transformation to observation - in forward or inverse direction */
enum PJ_DIRECTION {
diff --git a/src/projects.h b/src/projects.h
index 2af382e5..cbb980ca 100644
--- a/src/projects.h
+++ b/src/projects.h
@@ -200,6 +200,12 @@ struct PJ_REGION_S {
double ur_lat;
};
+struct PJ_AREA {
+ int id; /* Area ID in the EPSG database */
+ LP ll; /* Lower left corner of bounding box */
+ LP ur; /* Upper right corner of bounding box */
+ char descr[64]; /* text representation of area */
+};
struct projCtx_t;
typedef struct projCtx_t projCtx_t;