PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ gserialized_get_srid()

int32_t gserialized_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 69 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(), test_serialized_srid(), topologypreservesimplify(), touches(), transform(), transform_geom(), and TWKBFromLWGEOM().

70 {
71  int32_t srid = 0;
72  srid = srid | (s->srid[0] << 16);
73  srid = srid | (s->srid[1] << 8);
74  srid = srid | s->srid[2];
75  /* Only the first 21 bits are set. Slide up and back to pull
76  the negative bits down, if we need them. */
77  srid = (srid<<11)>>11;
79  /* 0 is our internal unknown value. We'll map back and forth here for now */
80  if ( srid == 0 )
81  return SRID_UNKNOWN;
82  else
83  return clamp_srid(srid);
84 }
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:350
Unknown SRID value.
Definition: liblwgeom.h:172
char * s
Definition: cu_in_wkt.c:23
Here is the call graph for this function: