PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ ST_AsGeoJsonRow()

Datum ST_AsGeoJsonRow ( PG_FUNCTION_ARGS  )

Definition at line 92 of file lwgeom_out_geojson.c.

93{
94 Datum array = PG_GETARG_DATUM(0);
95 text *geom_column_text = PG_GETARG_TEXT_P(1);
96 char *geom_column = PG_ARGISNULL(1) ? "" : text_to_cstring(geom_column_text);
97 int32 maxdecimaldigits = PG_GETARG_INT32(2);
98 bool do_pretty = PG_GETARG_BOOL(3);
99 text *id_column_text = PG_GETARG_TEXT_P(4);
100 char *id_column = PG_ARGISNULL(4) ? "" : text_to_cstring(id_column_text);
101 StringInfoData result;
102 Oid geom_oid = InvalidOid;
103 Oid geog_oid = InvalidOid;
104
105 /* We need to initialize the internal cache to access it later via postgis_oid() */
106 postgis_initialize_cache();
107 geom_oid = postgis_oid(GEOMETRYOID);
108 geog_oid = postgis_oid(GEOGRAPHYOID);
109
110 if (strlen(geom_column) == 0)
111 geom_column = NULL;
112 if (strlen(id_column) == 0)
113 id_column = NULL;
114
115 initStringInfo(&result);
116
117 composite_to_geojson(fcinfo, array, geom_column, id_column, maxdecimaldigits, &result, do_pretty, geom_oid, geog_oid);
118
119 PG_RETURN_TEXT_P(cstring_to_text_with_len(result.data, result.len));
120}
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: