233{
234
235 uint32_t npoints = 0;
236 uint32_t i;
240
241
242 if (points == NULL) return NULL;
243
244 if (npoints == 0)
245 {
247 if (input_empty)
248 {
250 }
251 else
252 {
253 lwerror(
"Median failed to find non-empty input points with positive weight.");
254 return NULL;
255 }
256 }
257
259
260 i =
iterate_4d(&median, points, npoints, max_iter, tol);
261
263
264 if (fail_if_not_converged && i >= max_iter)
265 {
266 lwerror(
"Median failed to converge within %g after %d iterations.", tol, max_iter);
267 return NULL;
268 }
269
271 {
273 }
274 else
275 {
277 }
278}
LWPOINT * lwpoint_make3dz(int32_t srid, double x, double y, double z)
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
LWPOINT * lwpoint_make2d(int32_t srid, double x, double y)
LWPOINT * lwpoint_construct_empty(int32_t srid, char hasz, char hasm)
#define LW_TRUE
Return types for functions with status returns.
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.