PostGIS  2.4.9dev-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 100 of file g_serialized.c.

References 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_collect(), lwgeom_from_gserialized(), LWGEOM_from_WKB(), LWGEOM_get_srid(), LWGEOM_line_interpolate_point(), LWGEOM_line_locate_point(), LWGEOM_locate_between_m(), 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().

101 {
102  int32_t srid = 0;
103  srid = srid | (s->srid[0] << 16);
104  srid = srid | (s->srid[1] << 8);
105  srid = srid | s->srid[2];
106  /* Only the first 21 bits are set. Slide up and back to pull
107  the negative bits down, if we need them. */
108  srid = (srid<<11)>>11;
110  /* 0 is our internal unknown value. We'll map back and forth here for now */
111  if ( srid == 0 )
112  return SRID_UNKNOWN;
113  else
114  return srid;
115 }
Unknown SRID value.
Definition: liblwgeom.h:188
char * s
Definition: cu_in_wkt.c:23