PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ gserialized_set_srid()

void gserialized_set_srid ( GSERIALIZED g,
int32_t  srid 
)

Write the SRID into the serialized form (it is packed into three bytes so this is a handy function).

Definition at line 117 of file g_serialized.c.

118 {
119  LWDEBUGF(3, "Called with srid = %d", srid);
120 
121  srid = clamp_srid(srid);
122 
123  /* 0 is our internal unknown value.
124  * We'll map back and forth here for now */
125  if ( srid == SRID_UNKNOWN )
126  srid = 0;
127 
128  s->srid[0] = (srid & 0x001F0000) >> 16;
129  s->srid[1] = (srid & 0x0000FF00) >> 8;
130  s->srid[2] = (srid & 0x000000FF);
131 }
char * s
Definition: cu_in_wkt.c:23
int clamp_srid(int srid)
Return a valid SRID from an arbitrary integer Raises a notice if what comes out is different from wha...
Definition: lwutil.c:347
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:188
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88

References clamp_srid(), LWDEBUGF, s, and SRID_UNKNOWN.

Referenced by BOX3D_to_LWGEOM(), gserialized_from_lwgeom(), LWGEOM_from_WKB(), LWGEOM_set_srid(), and test_serialized_srid().

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