PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ gserialized2_get_srid()

int32_t gserialized2_get_srid ( const GSERIALIZED g)

Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function).

Definition at line 191 of file gserialized2.c.

192 {
193  int32_t srid = 0;
194  srid = srid | (g->srid[0] << 16);
195  srid = srid | (g->srid[1] << 8);
196  srid = srid | (g->srid[2]);
197  /* Only the first 21 bits are set. Slide up and back to pull
198  the negative bits down, if we need them. */
199  srid = (srid<<11)>>11;
200 
201  /* 0 is our internal unknown value. We'll map back and forth here for now */
202  if (srid == 0)
203  return SRID_UNKNOWN;
204  else
205  return srid;
206 }
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:215
uint8_t srid[3]
Definition: liblwgeom.h:445

References GSERIALIZED::srid, and SRID_UNKNOWN.

Referenced by gserialized2_hash(), gserialized_get_srid(), lwgeom_from_gserialized2(), and test_gserialized2_srid().

Here is the caller graph for this function: