[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha1-123-g7feaa9d
git at osgeo.org
git at osgeo.org
Tue May 26 05:28:16 PDT 2020
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, master has been updated
via 7feaa9d82c37efb5d5454e0ac144878062487bde (commit)
from 16121bf7939891022824152c0ca095aeebbad2ed (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 7feaa9d82c37efb5d5454e0ac144878062487bde
Author: Raúl Marín <git at rmr.ninja>
Date: Tue May 26 11:36:15 2020 +0200
Fix GetGenericCacheCollection call from composite_to_geojson
Closes #4965
diff --git a/postgis/lwgeom_out_geojson.c b/postgis/lwgeom_out_geojson.c
index 4d82148..0c24319 100644
--- a/postgis/lwgeom_out_geojson.c
+++ b/postgis/lwgeom_out_geojson.c
@@ -54,10 +54,14 @@ static void array_dim_to_json(StringInfo result, int dim, int ndims, int *dims,
bool use_line_feeds);
static void array_to_json_internal(Datum array, StringInfo result,
bool use_line_feeds);
-static void composite_to_geojson(Datum composite,
- char *geom_column_name, int32 maxdecimaldigits,
- StringInfo result, bool use_line_feeds,
- Oid geom_oid, Oid geog_oid);
+static void composite_to_geojson(FunctionCallInfo fcinfo,
+ Datum composite,
+ char *geom_column_name,
+ int32 maxdecimaldigits,
+ StringInfo result,
+ bool use_line_feeds,
+ Oid geom_oid,
+ Oid geog_oid);
static void composite_to_json(Datum composite, StringInfo result,
bool use_line_feeds);
static void datum_to_json(Datum val, bool is_null, StringInfo result,
@@ -98,7 +102,7 @@ ST_AsGeoJsonRow(PG_FUNCTION_ARGS)
result = makeStringInfo();
- composite_to_geojson(array, geom_column, maxdecimaldigits, result, do_pretty, geom_oid, geog_oid);
+ composite_to_geojson(fcinfo, array, geom_column, maxdecimaldigits, result, do_pretty, geom_oid, geog_oid);
PG_RETURN_TEXT_P(cstring_to_text_with_len(result->data, result->len));
}
@@ -107,8 +111,14 @@ ST_AsGeoJsonRow(PG_FUNCTION_ARGS)
* Turn a composite / record into GEOJSON.
*/
static void
-composite_to_geojson(Datum composite, char *geom_column_name, int32 maxdecimaldigits,
- StringInfo result, bool use_line_feeds, Oid geom_oid, Oid geog_oid)
+composite_to_geojson(FunctionCallInfo fcinfo,
+ Datum composite,
+ char *geom_column_name,
+ int32 maxdecimaldigits,
+ StringInfo result,
+ bool use_line_feeds,
+ Oid geom_oid,
+ Oid geog_oid)
{
HeapTupleHeader td;
Oid tupType;
@@ -166,8 +176,14 @@ composite_to_geojson(Datum composite, char *geom_column_name, int32 maxdecimaldi
val = heap_getattr(tuple, i + 1, tupdesc, &isnull);
if (!isnull)
{
- appendStringInfo(result, "%s",
- TextDatumGetCString(DirectFunctionCall2(LWGEOM_asGeoJson, val, Int32GetDatum(maxdecimaldigits))));
+ appendStringInfo(
+ result,
+ "%s",
+ TextDatumGetCString(CallerFInfoFunctionCall2(LWGEOM_asGeoJson,
+ fcinfo->flinfo,
+ InvalidOid,
+ val,
+ Int32GetDatum(maxdecimaldigits))));
}
else
{
diff --git a/regress/core/Makefile.in b/regress/core/Makefile.in
index 46bfdf5..bf2c851 100644
--- a/regress/core/Makefile.in
+++ b/regress/core/Makefile.in
@@ -166,7 +166,8 @@ TESTS = \
regress_brin_index_geography \
minimum_clearance \
oriented_envelope \
- point_coordinates
+ point_coordinates \
+ out_geojson
# Slow slow tests
TESTS_SLOW = \
diff --git a/regress/core/out_geojson.sql b/regress/core/out_geojson.sql
index e6f5375..5c235e5 100644
--- a/regress/core/out_geojson.sql
+++ b/regress/core/out_geojson.sql
@@ -35,4 +35,9 @@ SELECT 'gj03', i, to_json(g.*) AS rj3
SELECT 'gj04', i, to_jsonb(g.*) AS rj4
FROM g ORDER BY i;
+SELECT '4695', ST_ASGeoJSON(a.*) FROM
+(
+ SELECT 1 as v, ST_SetSRID(ST_Point(0,1),2227) as g
+) a;
+
DROP TABLE g;
diff --git a/regress/core/out_geojson_expected b/regress/core/out_geojson_expected
index 085261e..25a2259 100644
--- a/regress/core/out_geojson_expected
+++ b/regress/core/out_geojson_expected
@@ -27,3 +27,4 @@ gj04|4|{"d": "2004-04-04", "f": 4.4, "g": {"type": "GeometryCollection", "geomet
gj04|5|{"d": "2005-05-05", "f": 5.5, "g": {"type": "Point", "coordinates": []}, "i": 5, "t": "five"}
gj04|6|{"d": "2006-06-06", "f": 6.6, "g": null, "i": 6, "t": "six"}
gj04|7|{"d": "2007-07-07", "f": 7.7, "g": {"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": []}, {"type": "Point", "coordinates": [1, 2]}]}, "i": 7, "t": "seven"}
+4695|{"type": "Feature", "geometry": {"type":"Point","crs":{"type":"name","properties":{"name":"EPSG:2227"}},"coordinates":[0,1]}, "properties": {"v": 1}}
-----------------------------------------------------------------------
Summary of changes:
postgis/lwgeom_out_geojson.c | 34 +++++++++++++++++++++++++---------
regress/core/Makefile.in | 3 ++-
regress/core/out_geojson.sql | 5 +++++
regress/core/out_geojson_expected | 1 +
4 files changed, 33 insertions(+), 10 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list