PostGIS
2.5.7dev-r@@SVN_REVISION@@
◆
out_geojson_test_precision()
static void out_geojson_test_precision
(
void
)
static
Definition at line
58
of file
cu_out_geojson.c
.
59
{
60
/* 0 precision, i.e a round */
61
do_geojson_test
(
62
"POINT(1.1111111111111 1.1111111111111)"
,
63
"{\"type\":\"Point\",\"coordinates\":[1,1]}"
,
64
NULL, 0, 0);
65
66
/* 3 digits precision */
67
do_geojson_test
(
68
"POINT(1.1111111111111 1.1111111111111)"
,
69
"{\"type\":\"Point\",\"coordinates\":[1.111,1.111]}"
,
70
NULL, 3, 0);
71
72
/* 9 digits precision */
73
do_geojson_test
(
74
"POINT(1.2345678901234 1.2345678901234)"
,
75
"{\"type\":\"Point\",\"coordinates\":[1.23456789,1.23456789]}"
,
76
NULL, 9, 0);
77
78
/* huge data */
79
do_geojson_test
(
80
"POINT(1E300 -1E300)"
,
81
"{\"type\":\"Point\",\"coordinates\":[1e+300,-1e+300]}"
,
82
NULL, 0, 0);
83
84
/* huge precision, see http://trac.osgeo.org/postgis/ticket/2052 */
85
do_geojson_test
(
86
"POINT(1 2)"
,
87
"{\"type\":\"Point\",\"coordinates\":[1,2]}"
,
88
NULL, 100, 0);
89
90
/* double precision, see http://trac.osgeo.org/postgis/ticket/2051 */
91
do_geojson_test
(
92
"POINT(59.99 -59.99)"
,
93
"{\"type\":\"Point\",\"coordinates\":[59.99,-59.99]}"
,
94
NULL, 15, 0);
95
96
/* small numbers */
97
/* NOTE: precision of 300 will be converted to max precision (15)
98
* and being there no significant digit within that range
99
* only zeroes will be returned
100
* See http://trac.osgeo.org/postgis/ticket/2051#comment:11
101
*/
102
do_geojson_test
(
"POINT(1E-300 -2E-200)"
,
103
"{\"type\":\"Point\",\"coordinates\":[0,0]}"
,
104
NULL,
105
300,
106
0);
107
}
do_geojson_test
static void do_geojson_test(char *in, char *out, char *srs, int precision, int has_bbox)
Definition:
cu_out_geojson.c:20
References
do_geojson_test()
.
Here is the call graph for this function:
liblwgeom
cunit
cu_out_geojson.c
Generated by
1.9.1