From bd723085ca595b6d9b29ecef08d983ef551b1a3a Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Tue, 30 Apr 2019 16:45:35 +0000 Subject: [PATCH] Add json casts to doc, set json cast precision to defaults used in other functions git-svn-id: http://svn.osgeo.org/postgis/trunk@17418 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/reference_output.xml | 18 ++++++------------ doc/reference_type.xml | 8 ++++++++ postgis/lwgeom_export.c | 4 ++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/doc/reference_output.xml b/doc/reference_output.xml index e585afba8..7cea2f22a 100644 --- a/doc/reference_output.xml +++ b/doc/reference_output.xml @@ -329,22 +329,22 @@ CIRCULARSTRING(220268 150415 1,220227 150505 2,220227 150406 3) text ST_AsGeoJSON - record feature - text geomcolumnname + geometry geom integer maxdecimaldigits=15 - boolean prettyprint=false + integer options=0 text ST_AsGeoJSON - geometry geom + geography geog integer maxdecimaldigits=15 integer options=0 text ST_AsGeoJSON - geography geog + record feature + text geomcolumnname integer maxdecimaldigits=15 - integer options=0 + boolean prettyprint=false @@ -377,12 +377,6 @@ CIRCULARSTRING(220268 150415 1,220227 150505 2,220227 150406 3) - Version 1: ST_AsGeoJSON(geom) / maxdecimaldigits=15 version=1 options=0 - Version 2: ST_AsGeoJSON(geom, maxdecimaldigits) / version=1 options=0 - Version 3: ST_AsGeoJSON(geom, maxdecimaldigits, options) / version=1 - Version 4: ST_AsGeoJSON(gj_version, geom) / maxdecimaldigits=15 options=0 - Version 5: ST_AsGeoJSON(gj_version, geom, maxdecimaldigits) / options=0 - Version 6: ST_AsGeoJSON(gj_version, geom, maxdecimaldigits, options) Availability: 1.3.4 Availability: 1.5.0 geography support was introduced. diff --git a/doc/reference_type.xml b/doc/reference_type.xml index 62f1b0ebe..7f5eecb90 100644 --- a/doc/reference_type.xml +++ b/doc/reference_type.xml @@ -143,6 +143,14 @@ text automatic + + json + automatic + + + jsonb + automatic + diff --git a/postgis/lwgeom_export.c b/postgis/lwgeom_export.c index 54aac7ac1..7759b8970 100644 --- a/postgis/lwgeom_export.c +++ b/postgis/lwgeom_export.c @@ -431,7 +431,7 @@ Datum geometry_to_json(PG_FUNCTION_ARGS) { GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0); LWGEOM *lwgeom = lwgeom_from_gserialized(geom); - char *geojson = lwgeom_to_geojson(lwgeom, NULL, 9, 0); + char *geojson = lwgeom_to_geojson(lwgeom, NULL, 15, 0); text *result = cstring_to_text(geojson); lwgeom_free(lwgeom); pfree(geojson); @@ -444,7 +444,7 @@ Datum geometry_to_jsonb(PG_FUNCTION_ARGS) { GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0); LWGEOM *lwgeom = lwgeom_from_gserialized(geom); - char *geojson = lwgeom_to_geojson(lwgeom, NULL, 9, 0); + char *geojson = lwgeom_to_geojson(lwgeom, NULL, 15, 0); lwgeom_free(lwgeom); PG_RETURN_DATUM(DirectFunctionCall1(jsonb_in, PointerGetDatum(geojson))); } -- 2.40.0