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

◆ gserialized1_get_srid()

int32_t gserialized1_get_srid ( const GSERIALIZED s)

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

Definition at line 143 of file gserialized1.c.

144{
145 int32_t srid = 0;
146 srid = srid | (s->srid[0] << 16);
147 srid = srid | (s->srid[1] << 8);
148 srid = srid | s->srid[2];
149 /* Only the first 21 bits are set. Slide up and back to pull
150 the negative bits down, if we need them. */
151 srid = (srid<<11)>>11;
152
153 /* 0 is our internal unknown value. We'll map back and forth here for now */
154 if ( srid == 0 )
155 return SRID_UNKNOWN;
156 else
157 return srid;
158}
char * s
Definition cu_in_wkt.c:23
#define SRID_UNKNOWN
Unknown SRID value.
Definition liblwgeom.h:215

References s, and SRID_UNKNOWN.

Referenced by gserialized1_hash(), gserialized_get_srid(), lwgeom_from_gserialized1(), and test_serialized1_srid().

Here is the caller graph for this function: