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

◆ lwgeom_length_2d()

double lwgeom_length_2d ( const LWGEOM geom)

Definition at line 2088 of file lwgeom.c.

2089{
2090 int type = geom->type;
2091 if ( type == LINETYPE )
2092 return lwline_length_2d((LWLINE*)geom);
2093 else if ( type == CIRCSTRINGTYPE )
2094 return lwcircstring_length_2d((LWCIRCSTRING*)geom);
2095 else if ( type == COMPOUNDTYPE )
2096 return lwcompound_length_2d((LWCOMPOUND*)geom);
2097 else if ( type != CURVEPOLYTYPE && lwgeom_is_collection(geom) )
2098 {
2099 double length = 0.0;
2100 uint32_t i;
2101 LWCOLLECTION *col = (LWCOLLECTION*)geom;
2102 for ( i = 0; i < col->ngeoms; i++ )
2103 length += lwgeom_length_2d(col->geoms[i]);
2104 return length;
2105 }
2106 else
2107 return 0.0;
2108}
#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:530
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:1125
double lwgeom_length_2d(const LWGEOM *geom)
Definition lwgeom.c:2088
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: