PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ point4d_transform()

int point4d_transform ( POINT4D pt,
projPJ  srcpj,
projPJ  dstpj 
)

Definition at line 131 of file liblwgeom/lwgeom_transform.c.

132 {
133  POINT3D orig_pt = {pt->x, pt->y, pt->z}; /* Copy for error report*/
134 
135  if (pj_is_latlong(srcpj)) to_rad(pt) ;
136 
137  LWDEBUGF(4, "transforming POINT(%f %f) from '%s' to '%s'",
138  orig_pt.x, orig_pt.y, pj_get_def(srcpj,0), pj_get_def(dstpj,0));
139 
140  if (pj_transform(srcpj, dstpj, 1, 0, &(pt->x), &(pt->y), &(pt->z)) != 0)
141  {
142  int pj_errno_val = *pj_get_errno_ref();
143  if (pj_errno_val == -38)
144  {
145  lwnotice("PostGIS was unable to transform the point because either no grid"
146  " shift files were found, or the point does not lie within the "
147  "range for which the grid shift is defined. Refer to the "
148  "ST_Transform() section of the PostGIS manual for details on how "
149  "to configure PostGIS to alter this behaviour.");
150  lwerror("transform: couldn't project point (%g %g %g): %s (%d)",
151  orig_pt.x, orig_pt.y, orig_pt.z,
152  pj_strerrno(pj_errno_val), pj_errno_val);
153  }
154  else
155  {
156  lwerror("transform: couldn't project point (%g %g %g): %s (%d)",
157  orig_pt.x, orig_pt.y, orig_pt.z,
158  pj_strerrno(pj_errno_val), pj_errno_val);
159  }
160  return LW_FAILURE;
161  }
162 
163  if (pj_is_latlong(dstpj)) to_dec(pt);
164  return LW_SUCCESS;
165 }
static void to_rad(POINT4D *pt)
convert decimal degress to radians
static void to_dec(POINT4D *pt)
convert radians to decimal degress
#define LW_FAILURE
Definition: liblwgeom.h:79
#define LW_SUCCESS
Definition: liblwgeom.h:80
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:177
double z
Definition: liblwgeom.h:343
double x
Definition: liblwgeom.h:343
double y
Definition: liblwgeom.h:343
double x
Definition: liblwgeom.h:355
double z
Definition: liblwgeom.h:355
double y
Definition: liblwgeom.h:355

References LW_FAILURE, LW_SUCCESS, LWDEBUGF, lwerror(), lwnotice(), to_dec(), to_rad(), POINT3D::x, POINT4D::x, POINT3D::y, POINT4D::y, POINT3D::z, and POINT4D::z.

Referenced by ptarray_transform().

Here is the call graph for this function:
Here is the caller graph for this function: