[postgis-tickets] r17418 - Add json casts to doc, set json cast precision
Paul Ramsey
pramsey at cleverelephant.ca
Tue Apr 30 09:45:35 PDT 2019
Author: pramsey
Date: 2019-04-30 09:45:35 -0700 (Tue, 30 Apr 2019)
New Revision: 17418
Modified:
trunk/doc/reference_output.xml
trunk/doc/reference_type.xml
trunk/postgis/lwgeom_export.c
Log:
Add json casts to doc, set json cast precision
to defaults used in other functions
Modified: trunk/doc/reference_output.xml
===================================================================
--- trunk/doc/reference_output.xml 2019-04-29 16:16:56 UTC (rev 17417)
+++ trunk/doc/reference_output.xml 2019-04-30 16:45:35 UTC (rev 17418)
@@ -329,22 +329,22 @@
<funcsynopsis>
<funcprototype>
<funcdef>text <function>ST_AsGeoJSON</function></funcdef>
- <paramdef><type>record </type> <parameter>feature</parameter></paramdef>
- <paramdef choice="opt"><type>text </type> <parameter>geomcolumnname</parameter></paramdef>
+ <paramdef><type>geometry </type> <parameter>geom</parameter></paramdef>
<paramdef choice="opt"><type>integer </type> <parameter>maxdecimaldigits=15</parameter></paramdef>
- <paramdef choice="opt"><type>boolean </type> <parameter>prettyprint=false</parameter></paramdef>
+ <paramdef choice="opt"><type>integer </type> <parameter>options=0</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>text <function>ST_AsGeoJSON</function></funcdef>
- <paramdef><type>geometry </type> <parameter>geom</parameter></paramdef>
+ <paramdef><type>geography </type> <parameter>geog</parameter></paramdef>
<paramdef choice="opt"><type>integer </type> <parameter>maxdecimaldigits=15</parameter></paramdef>
<paramdef choice="opt"><type>integer </type> <parameter>options=0</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>text <function>ST_AsGeoJSON</function></funcdef>
- <paramdef><type>geography </type> <parameter>geog</parameter></paramdef>
+ <paramdef><type>record </type> <parameter>feature</parameter></paramdef>
+ <paramdef choice="opt"><type>text </type> <parameter>geomcolumnname</parameter></paramdef>
<paramdef choice="opt"><type>integer </type> <parameter>maxdecimaldigits=15</parameter></paramdef>
- <paramdef choice="opt"><type>integer </type> <parameter>options=0</parameter></paramdef>
+ <paramdef choice="opt"><type>boolean </type> <parameter>prettyprint=false</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
@@ -377,12 +377,6 @@
</listitem>
</itemizedlist>
</para>
- <para>Version 1: ST_AsGeoJSON(geom) / maxdecimaldigits=15 version=1 options=0</para>
- <para>Version 2: ST_AsGeoJSON(geom, maxdecimaldigits) / version=1 options=0</para>
- <para>Version 3: ST_AsGeoJSON(geom, maxdecimaldigits, options) / version=1</para>
- <para>Version 4: ST_AsGeoJSON(gj_version, geom) / maxdecimaldigits=15 options=0</para>
- <para>Version 5: ST_AsGeoJSON(gj_version, geom, maxdecimaldigits) / options=0</para>
- <para>Version 6: ST_AsGeoJSON(gj_version, geom, maxdecimaldigits, options)</para>
<para>Availability: 1.3.4</para>
<para>Availability: 1.5.0 geography support was introduced.</para>
Modified: trunk/doc/reference_type.xml
===================================================================
--- trunk/doc/reference_type.xml 2019-04-29 16:16:56 UTC (rev 17417)
+++ trunk/doc/reference_type.xml 2019-04-30 16:45:35 UTC (rev 17418)
@@ -143,6 +143,14 @@
<entry>text</entry>
<entry>automatic</entry>
</row>
+ <row>
+ <entry>json</entry>
+ <entry>automatic</entry>
+ </row>
+ <row>
+ <entry>jsonb</entry>
+ <entry>automatic</entry>
+ </row>
</tbody>
</tgroup>
</informaltable>
Modified: trunk/postgis/lwgeom_export.c
===================================================================
--- trunk/postgis/lwgeom_export.c 2019-04-29 16:16:56 UTC (rev 17417)
+++ trunk/postgis/lwgeom_export.c 2019-04-30 16:45:35 UTC (rev 17418)
@@ -431,7 +431,7 @@
{
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 @@
{
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)));
}
More information about the postgis-tickets
mailing list