PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ cart_to_lwpoint()

LWPOINT * cart_to_lwpoint ( const double_t  x_sum,
const double_t  y_sum,
const double_t  z_sum,
const double_t  weight_sum,
const int32_t  srid 
)

Definition at line 233 of file geography_centroid.c.

238{
239 double_t x = x_sum / weight_sum;
240 double_t y = y_sum / weight_sum;
241 double_t z = z_sum / weight_sum;
242
243 /* x-y-z vector length */
244 double_t r = sqrtl(powl(x, 2) + powl(y, 2) + powl(z, 2));
245
246 double_t lon = atan2l(y, x) * 180 / M_PI;
247 double_t lat = acosl(z / r) * 180 / M_PI - 90;
248
249 return lwpoint_make2d(srid, lon, lat);
250}
char * r
Definition cu_in_wkt.c:24
LWPOINT * lwpoint_make2d(int32_t srid, double x, double y)
Definition lwpoint.c:163

References lwpoint_make2d(), and r.

Referenced by geography_centroid_from_wpoints().

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