PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_wkb_needs_srid()

static int lwgeom_wkb_needs_srid ( const LWGEOM geom,
uint8_t  variant 
)
static

Definition at line 63 of file lwout_wkb.c.

References LW_FALSE, LW_TRUE, lwgeom_has_srid(), WKB_EXTENDED, and WKB_NO_SRID.

Referenced by empty_to_wkb_buf(), empty_to_wkb_size(), lwcollection_to_wkb_buf(), lwcollection_to_wkb_size(), lwgeom_wkb_type(), lwline_to_wkb_buf(), lwline_to_wkb_size(), lwpoint_to_wkb_buf(), lwpoint_to_wkb_size(), lwpoly_to_wkb_buf(), lwpoly_to_wkb_size(), lwtriangle_to_wkb_buf(), and lwtriangle_to_wkb_size().

64 {
65  /* Sub-components of collections inherit their SRID from the parent.
66  We force that behavior with the WKB_NO_SRID flag */
67  if ( variant & WKB_NO_SRID )
68  return LW_FALSE;
69 
70  /* We can only add an SRID if the geometry has one, and the
71  WKB form is extended */
72  if ( (variant & WKB_EXTENDED) && lwgeom_has_srid(geom) )
73  return LW_TRUE;
74 
75  /* Everything else doesn't get an SRID */
76  return LW_FALSE;
77 }
int lwgeom_has_srid(const LWGEOM *geom)
Return true or false depending on whether a geometry has a valid SRID set.
Definition: lwgeom.c:1389
uint8_t variant
Definition: cu_in_twkb.c:26
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
#define WKB_EXTENDED
Definition: liblwgeom.h:2076
#define WKB_NO_SRID
Definition: liblwgeom.h:2081
Here is the call graph for this function:
Here is the caller graph for this function: