PostGIS  2.5.0beta2dev-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 99 of file g_serialized.c.

References GSERIALIZED::srid, and SRID_UNKNOWN.

Referenced by ARRAY2GEOS(), ARRAY2LWGEOM(), boundary(), buffer(), 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_angle(), LWGEOM_asEncodedPolyline(), LWGEOM_asGeoJson(), LWGEOM_asGML(), LWGEOM_asX3D(), LWGEOM_collect(), lwgeom_from_gserialized(), LWGEOM_from_WKB(), LWGEOM_get_srid(), lwgeom_hash(), LWGEOM_line_interpolate_point(), LWGEOM_line_locate_point(), LWGEOM_locate_between_m(), LWGEOM_makeline(), overlaps(), pgis_union_geometry_array(), 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(), ST_OrientedEnvelope(), test_serialized_srid(), topologypreservesimplify(), touches(), transform(), and TWKBFromLWGEOM().

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