PostGIS  2.5.1dev-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 116 of file g_serialized.c.

References clamp_srid(), LWDEBUGF, GSERIALIZED::srid, and SRID_UNKNOWN.

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

117 {
118  LWDEBUGF(3, "Called with srid = %d", srid);
119 
120  srid = clamp_srid(srid);
121 
122  /* 0 is our internal unknown value.
123  * We'll map back and forth here for now */
124  if ( srid == SRID_UNKNOWN )
125  srid = 0;
126 
127  s->srid[0] = (srid & 0x001F0000) >> 16;
128  s->srid[1] = (srid & 0x0000FF00) >> 8;
129  s->srid[2] = (srid & 0x000000FF);
130 }
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:187
char * s
Definition: cu_in_wkt.c:23
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
Here is the call graph for this function:
Here is the caller graph for this function: