PostGIS  2.2.7dev-r@@SVN_REVISION@@
Datum geometry_geometrytype ( PG_FUNCTION_ARGS  )

Definition at line 162 of file lwgeom_ogc.c.

References gserialized_get_type(), gserialized_max_header_size(), and lwtype_name().

163 {
164  GSERIALIZED *gser;
165  text *type_text;
166  static int type_str_len = 32;
167  char type_str[type_str_len];
168 
169  /* Read just the header from the toasted tuple */
170  gser = PG_GETARG_GSERIALIZED_P_SLICE(0, 0, gserialized_max_header_size());
171 
172  /* Make it empty string to start */
173  type_str[0] = 0;
174 
175  /* Build up the output string */
176  strncat(type_str, "ST_", type_str_len);
177  strncat(type_str, lwtype_name(gserialized_get_type(gser)), type_str_len - 3);
178 
179  /* Build a text type to store things in */
180  type_text = cstring2text(type_str);
181 
182  PG_FREE_IF_COPY(gser, 0);
183  PG_RETURN_TEXT_P(type_text);
184 }
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area...
Definition: g_serialized.c:55
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
uint32_t gserialized_max_header_size(void)
Returns the size in bytes to read from toast to get the basic information from a geometry: GSERIALIZE...
Definition: g_serialized.c:49

Here is the call graph for this function: