PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ gserialized1_set_srid()

void gserialized1_set_srid ( GSERIALIZED s,
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 159 of file gserialized1.c.

160 {
161  LWDEBUGF(3, "%s called with srid = %d", __func__, srid);
162 
163  srid = clamp_srid(srid);
164 
165  /* 0 is our internal unknown value.
166  * We'll map back and forth here for now */
167  if ( srid == SRID_UNKNOWN )
168  srid = 0;
169 
170  s->srid[0] = (srid & 0x001F0000) >> 16;
171  s->srid[1] = (srid & 0x0000FF00) >> 8;
172  s->srid[2] = (srid & 0x000000FF);
173 }
char * s
Definition: cu_in_wkt.c:23
#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

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

Referenced by gserialized1_from_lwgeom(), gserialized_set_srid(), and test_serialized1_srid().

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