PostGIS  2.1.10dev-r@@SVN_REVISION@@
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 70 of file g_serialized.c.

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

Referenced by boundary(), buffer(), centroid(), contains(), containsproperly(), convexhull(), coveredby(), covers(), crosses(), disjoint(), geography_area(), geography_azimuth(), geography_distance(), geography_distance_tree(), geography_distance_uncached(), geography_dwithin(), geography_dwithin_uncached(), geography_length(), geography_perimeter(), geography_project(), geometry_distance_spheroid(), geos_intersects(), linemerge(), 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(), polygonize_garray(), POSTGIS2SFCGALPreparedGeometry(), postgis_valid_typmod(), RASTER_asRaster(), RASTER_clip(), RASTER_nearestValue(), RASTER_setPixelValuesGeomval(), relate_full(), relate_pattern(), sfcgal_extrude(), sfcgal_force_lhr(), sfcgal_intersection(), sfcgal_intersection3D(), sfcgal_minkowski_sum(), sfcgal_straight_skeleton(), sfcgal_tesselate(), sfcgal_triangulate(), ST_Equals(), ST_InterpolatePoint(), ST_LineCrossingDirection(), ST_UnaryUnion(), test_serialized_srid(), topologypreservesimplify(), touches(), transform(), and transform_geom().

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

Here is the call graph for this function: