PostGIS 3.0.6dev-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 142 of file gserialized1.c.

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

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: