PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ gserialized2_set_srid()

void gserialized2_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 207 of file gserialized2.c.

208 {
209  LWDEBUGF(3, "%s called with srid = %d", __func__, srid);
210 
211  srid = clamp_srid(srid);
212 
213  /* 0 is our internal unknown value.
214  * We'll map back and forth here for now */
215  if (srid == SRID_UNKNOWN)
216  srid = 0;
217 
218  g->srid[0] = (srid & 0x001F0000) >> 16;
219  g->srid[1] = (srid & 0x0000FF00) >> 8;
220  g->srid[2] = (srid & 0x000000FF);
221 }
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:229
int32_t clamp_srid(int32_t srid)
Return a valid SRID from an arbitrary integer Raises a notice if what comes out is different from wha...
Definition: lwutil.c:333
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
uint8_t srid[3]
Definition: liblwgeom.h:431

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

Referenced by gserialized2_from_lwgeom(), gserialized_set_srid(), and test_gserialized2_srid().

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