PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ ST_AsGeoJsonRow()

Datum ST_AsGeoJsonRow ( PG_FUNCTION_ARGS  )

Definition at line 85 of file lwgeom_out_geojson.c.

86 {
87  Datum array = PG_GETARG_DATUM(0);
88  text *geom_column_text = PG_GETARG_TEXT_P(1);
89  int32 maxdecimaldigits = PG_GETARG_INT32(2);
90  bool do_pretty = PG_GETARG_BOOL(3);
91  text *id_column_text = PG_GETARG_TEXT_P(4);
92  StringInfo result;
93  char *geom_column = text_to_cstring(geom_column_text);
94  char *id_column = text_to_cstring(id_column_text);
95  Oid geom_oid = InvalidOid;
96  Oid geog_oid = InvalidOid;
97 
98  /* We need to initialize the internal cache to access it later via postgis_oid() */
99  postgis_initialize_cache();
100  geom_oid = postgis_oid(GEOMETRYOID);
101  geog_oid = postgis_oid(GEOGRAPHYOID);
102 
103  if (strlen(geom_column) == 0)
104  geom_column = NULL;
105  if (strlen(id_column) == 0)
106  id_column = NULL;
107 
108  result = makeStringInfo();
109 
110  composite_to_geojson(fcinfo, array, geom_column, id_column, maxdecimaldigits, result, do_pretty, geom_oid, geog_oid);
111 
112  PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data, result->len));
113 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
static void composite_to_geojson(FunctionCallInfo fcinfo, Datum composite, char *geom_column_name, char *id_column_name, int32 maxdecimaldigits, StringInfo result, bool use_line_feeds, Oid geom_oid, Oid geog_oid)
unsigned int int32
Definition: shpopen.c:54

References composite_to_geojson(), and result.

Here is the call graph for this function: