Split lines into segments and calculate with middle of segment as weighted point.
Definition at line 251 of file geography_centroid.c.
References geography_centroid_from_wpoints(), LWMLINE::geoms, getPoint2d_cp(), LW_TRUE, lwgeom_distance_spheroid(), lwgeom_free(), lwgeom_set_geodetic(), lwpoint_as_lwgeom(), lwpoint_make2d(), POINT3DM::m, LWMLINE::ngeoms, POINTARRAY::npoints, LWLINE::points, LWMLINE::srid, POINT2D::x, POINT3DM::x, POINT2D::y, and POINT3DM::y.
Referenced by geography_centroid().
253 double_t tolerance = 0.0;
258 for (i = 0; i < mline->
ngeoms; i++) {
265 for (i = 0; i < mline->
ngeoms; i++) {
286 points[j].
m = weight;
291 points[j].
m = weight;
LWPOINT * lwpoint_make2d(int srid, double x, double y)
void lwgeom_free(LWGEOM *geom)
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, int n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from...
#define LW_TRUE
Return types for functions with status returns.
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
double lwgeom_distance_spheroid(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2, const SPHEROID *spheroid, double tolerance)
Calculate the geodetic distance from lwgeom1 to lwgeom2 on the spheroid.
LWPOINT * geography_centroid_from_wpoints(const uint32_t srid, const POINT3DM *points, const uint32_t size)
Convert lat-lon-points to x-y-z-coordinates, calculate a weighted average point and return lat-lon-co...