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

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

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

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: