PostGIS  2.1.10dev-r@@SVN_REVISION@@
void gserialized_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 87 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(), and test_serialized_srid().

88 {
89  LWDEBUGF(3, "Called with srid = %d", srid);
90 
91  srid = clamp_srid(srid);
92 
93  /* 0 is our internal unknown value.
94  * We'll map back and forth here for now */
95  if ( srid == SRID_UNKNOWN )
96  srid = 0;
97 
98  s->srid[0] = (srid & 0x001F0000) >> 16;
99  s->srid[1] = (srid & 0x0000FF00) >> 8;
100  s->srid[2] = (srid & 0x000000FF);
101 }
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:326
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:154
uint8_t srid[3]
Definition: liblwgeom.h:338
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55

Here is the call graph for this function:

Here is the caller graph for this function: