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

◆ 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 208 of file gserialized2.c.

209{
210 LWDEBUGF(3, "%s called with srid = %d", __func__, srid);
211
212 srid = clamp_srid(srid);
213
214 /* 0 is our internal unknown value.
215 * We'll map back and forth here for now */
216 if (srid == SRID_UNKNOWN)
217 srid = 0;
218
219 g->srid[0] = (srid & 0x001F0000) >> 16;
220 g->srid[1] = (srid & 0x0000FF00) >> 8;
221 g->srid[2] = (srid & 0x000000FF);
222}
#define SRID_UNKNOWN
Unknown SRID value.
Definition liblwgeom.h:215
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:339
#define LWDEBUGF(level, msg,...)
Definition lwgeom_log.h:106
uint8_t srid[3]
Definition liblwgeom.h:445

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: