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

◆ lwgeom_length_2d()

double lwgeom_length_2d ( const LWGEOM geom)

Definition at line 1952 of file lwgeom.c.

1953{
1954 int type = geom->type;
1955 if ( type == LINETYPE )
1956 return lwline_length_2d((LWLINE*)geom);
1957 else if ( type == CIRCSTRINGTYPE )
1958 return lwcircstring_length_2d((LWCIRCSTRING*)geom);
1959 else if ( type == COMPOUNDTYPE )
1960 return lwcompound_length_2d((LWCOMPOUND*)geom);
1961 else if ( lwgeom_is_collection(geom) )
1962 {
1963 double length = 0.0;
1964 uint32_t i;
1965 LWCOLLECTION *col = (LWCOLLECTION*)geom;
1966 for ( i = 0; i < col->ngeoms; i++ )
1967 length += lwgeom_length_2d(col->geoms[i]);
1968 return length;
1969 }
1970 else
1971 return 0.0;
1972}
#define COMPOUNDTYPE
Definition liblwgeom.h:124
#define LINETYPE
Definition liblwgeom.h:117
#define CIRCSTRINGTYPE
Definition liblwgeom.h:123
double lwline_length_2d(const LWLINE *line)
Definition lwline.c:517
double lwcircstring_length_2d(const LWCIRCSTRING *circ)
double lwcompound_length_2d(const LWCOMPOUND *comp)
Definition lwcompound.c:74
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition lwgeom.c:1079
double lwgeom_length_2d(const LWGEOM *geom)
Definition lwgeom.c:1952
uint32_t ngeoms
Definition liblwgeom.h:566
LWGEOM ** geoms
Definition liblwgeom.h:561
uint8_t type
Definition liblwgeom.h:448

References CIRCSTRINGTYPE, COMPOUNDTYPE, 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: