PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ gserialized_get_srid()

int32_t gserialized_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 83 of file g_serialized.c.

References clamp_srid(), GSERIALIZED::srid, and SRID_UNKNOWN.

Referenced by ARRAY2GEOS(), ARRAY2LWGEOM(), boundary(), buffer(), centroid(), contains(), containsproperly(), convexhull(), coveredby(), covers(), crosses(), disjoint(), geography_area(), geography_azimuth(), geography_distance(), geography_distance_knn(), geography_distance_tree(), geography_distance_uncached(), geography_dwithin(), geography_dwithin_uncached(), geography_length(), geography_perimeter(), geography_project(), geometry_distance_spheroid(), geos_intersects(), LWGEOM_asEncodedPolyline(), LWGEOM_asGeoJson(), LWGEOM_asGML(), LWGEOM_asX3D(), lwgeom_cmp(), LWGEOM_collect(), lwgeom_eq(), lwgeom_from_gserialized(), LWGEOM_from_WKB(), lwgeom_ge(), LWGEOM_get_srid(), lwgeom_gt(), lwgeom_le(), LWGEOM_line_interpolate_point(), LWGEOM_line_locate_point(), LWGEOM_locate_between_m(), lwgeom_lt(), LWGEOM_makeline(), overlaps(), pgis_union_geometry_array(), pointonsurface(), POSTGIS2SFCGALPreparedGeometry(), postgis_valid_typmod(), RASTER_asRaster(), RASTER_clip(), RASTER_nearestValue(), RASTER_setPixelValuesGeomval(), relate_full(), relate_pattern(), sfcgal_approximate_medial_axis(), sfcgal_difference(), sfcgal_difference3D(), sfcgal_extrude(), sfcgal_force_lhr(), sfcgal_intersection(), sfcgal_intersection3D(), sfcgal_minkowski_sum(), sfcgal_straight_skeleton(), sfcgal_tesselate(), sfcgal_triangulate(), sfcgal_union(), sfcgal_union3D(), ST_Equals(), ST_InterpolatePoint(), ST_LineCrossingDirection(), ST_MinimumBoundingCircle(), ST_MinimumBoundingRadius(), ST_MinimumClearanceLine(), test_serialized_srid(), topologypreservesimplify(), touches(), transform(), and TWKBFromLWGEOM().

84 {
85  int32_t srid = 0;
86  srid = srid | (s->srid[0] << 16);
87  srid = srid | (s->srid[1] << 8);
88  srid = srid | s->srid[2];
89  /* Only the first 21 bits are set. Slide up and back to pull
90  the negative bits down, if we need them. */
91  srid = (srid<<11)>>11;
92 
93  /* 0 is our internal unknown value. We'll map back and forth here for now */
94  if ( srid == 0 )
95  return SRID_UNKNOWN;
96  else
97  return clamp_srid(srid);
98 }
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:378
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:187
uint8_t srid[3]
Definition: liblwgeom.h:381
Here is the call graph for this function: