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

◆ lwgeom_length_2d()

double lwgeom_length_2d ( const LWGEOM geom)
extern

Definition at line 2060 of file lwgeom.c.

2061{
2062 int type = geom->type;
2063 if ( type == LINETYPE )
2064 return lwline_length_2d((LWLINE*)geom);
2065 else if ( type == CIRCSTRINGTYPE )
2066 return lwcircstring_length_2d((LWCIRCSTRING*)geom);
2067 else if ( type == COMPOUNDTYPE )
2068 return lwcompound_length_2d((LWCOMPOUND*)geom);
2069 else if ( type != CURVEPOLYTYPE && lwgeom_is_collection(geom) )
2070 {
2071 double length = 0.0;
2072 uint32_t i;
2073 LWCOLLECTION *col = (LWCOLLECTION*)geom;
2074 for ( i = 0; i < col->ngeoms; i++ )
2075 length += lwgeom_length_2d(col->geoms[i]);
2076 return length;
2077 }
2078 else
2079 return 0.0;
2080}
#define COMPOUNDTYPE
Definition liblwgeom.h:110
#define CURVEPOLYTYPE
Definition liblwgeom.h:111
#define LINETYPE
Definition liblwgeom.h:103
#define CIRCSTRINGTYPE
Definition liblwgeom.h:109
double lwline_length_2d(const LWLINE *line)
Definition lwline.c:520
double lwcircstring_length_2d(const LWCIRCSTRING *circ)
double lwcompound_length_2d(const LWCOMPOUND *comp)
Definition lwcompound.c:117
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM contains sub-geometries or not This basically just checks that the struct ...
Definition lwgeom.c:1097
double lwgeom_length_2d(const LWGEOM *geom)
Definition lwgeom.c:2060
uint32_t ngeoms
Definition liblwgeom.h:580
LWGEOM ** geoms
Definition liblwgeom.h:575
uint8_t type
Definition liblwgeom.h:462

References CIRCSTRINGTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LWCOLLECTION::geoms, LINETYPE, lwcircstring_length_2d(), lwcompound_length_2d(), lwgeom_is_collection(), lwgeom_length_2d(), lwline_length_2d(), LWCOLLECTION::ngeoms, and LWGEOM::type.

Referenced by gserialized_distance_nd(), lwcompound_length_2d(), lwcurvepoly_perimeter_2d(), LWGEOM_length2d_linestring(), and lwgeom_length_2d().

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