Split lines into segments and calculate with middle of segment as weighted point.
Definition at line 251 of file geography_centroid.c.
253 double_t tolerance = 0.0;
260 for (i = 0; i < mline->
ngeoms; i++) {
264 points = palloc(size*
sizeof(
POINT3DM));
266 for (i = 0; i < mline->
ngeoms; i++) {
288 points[j].
m = weight;
293 points[j].
m = weight;
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...
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
LWPOINT * lwpoint_make2d(int srid, double x, double y)
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.
void lwgeom_free(LWGEOM *geom)
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
#define LW_TRUE
Return types for functions with status returns.
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
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, s, LWMLINE::srid, POINT2D::x, POINT3DM::x, POINT2D::y, and POINT3DM::y.
Referenced by geography_centroid().