[postgis-tickets] r17134 - ST_AsMVT: parse JSON numeric values with decimals as doubles
Raul
raul at rmr.ninja
Fri Jan 11 04:33:56 PST 2019
Author: algunenano
Date: 2019-01-11 04:33:56 -0800 (Fri, 11 Jan 2019)
New Revision: 17134
Modified:
trunk/NEWS
trunk/postgis/mvt.c
trunk/regress/core/mvt_jsonb.sql
trunk/regress/core/mvt_jsonb_expected
Log:
ST_AsMVT: parse JSON numeric values with decimals as doubles
References #4292
Closes https://github.com/postgis/postgis/pull/357
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2019-01-10 18:21:41 UTC (rev 17133)
+++ trunk/NEWS 2019-01-11 12:33:56 UTC (rev 17134)
@@ -20,7 +20,7 @@
- #4267, Enable Proj 6 deprecated APIs (Darafei Praliaskouski, Raúl Marín)
- - #4268, Bump minimum SFCGAL version to 1.3.1 (Darafei Praliaskouski)
+ - #4268, Bump minimum SFCGAL version to 1.3.1 (Darafei Praliaskouski)
* New Features *
- #2902, postgis_geos_noop (Sandro Santilli)
@@ -59,8 +59,8 @@
- #4139, Make mixed-dimension ND index build tree correctly (Darafei Praliaskouski,
Arthur Lesuisse, Andrew Gierth, Raúl Marín)
- #4262, Document MULTISURFACE compatibility of ST_LineToCurve (Steven Ottens)
-
- #4276, ST_AsGeoJSON documentation refresh (Darafei Praliaskouski)
+ - #4292, ST_AsMVT: parse JSON numeric values with decimals as doubles (Raúl Marín)
PostGIS 2.5.0
2018/09/23
Modified: trunk/postgis/mvt.c
===================================================================
--- trunk/postgis/mvt.c 2019-01-10 18:21:41 UTC (rev 17133)
+++ trunk/postgis/mvt.c 2019-01-11 12:33:56 UTC (rev 17134)
@@ -615,7 +615,7 @@
PointerGetDatum(v.val.numeric)));
d = strtod(str, NULL);
l = strtol(str, NULL, 10);
- if ((long) d != l)
+ if (FP_NEQUALS(d, (double)l))
{
MVT_PARSE_VALUE(d, mvt_kv_double_value, double_values_hash,
double_value, sizeof(double));
Modified: trunk/regress/core/mvt_jsonb.sql
===================================================================
--- trunk/regress/core/mvt_jsonb.sql 2019-01-10 18:21:41 UTC (rev 17133)
+++ trunk/regress/core/mvt_jsonb.sql 2019-01-11 12:33:56 UTC (rev 17134)
@@ -11,3 +11,9 @@
SELECT '{"c3":"abasdadcd", "c1":5}'::jsonb,
ST_AsMVTGeom(ST_GeomFromText('POINT(25 17)'), ST_MakeBox2D(ST_Point(0, 0), ST_Point(4096, 4096)), 4096, 0, false) AS geom
) AS q;
+SELECT 'J4', encode(ST_AsMVT(q, 'test', 4096, 'geom'), 'base64') FROM (
+ SELECT '1.25'::double precision AS c1,
+ ST_AsMVTGeom(ST_GeomFromText('POINT (0 0)'),
+ ST_MakeBox2D(ST_Point(0, 0), ST_Point(4096, 4096)), 4096, 0, false) AS geom,
+ '{"test":1.75}'::jsonb as properties
+) AS q;
\ No newline at end of file
Modified: trunk/regress/core/mvt_jsonb_expected
===================================================================
--- trunk/regress/core/mvt_jsonb_expected 2019-01-10 18:21:41 UTC (rev 17133)
+++ trunk/regress/core/mvt_jsonb_expected 2019-01-11 12:33:56 UTC (rev 17134)
@@ -2,3 +2,5 @@
J2|GisKBHRlc3QSDhIEAAABABgBIgQJMt4/GgJjMRoCYzIiBgoEYWJjZCiAIHgC
J3|GlAKBHRlc3QSDhIEAAABABgBIgQJMt4/Eg4SBAABAgIYASIECTLePxoCYzEaAmMyGgJjMyIGCgRh
YmNkIgIoBSILCglhYmFzZGFkY2QogCB4Ag==
+J4|GjsKBHRlc3QSDhIEAAABARgBIgQJAIBAGgJjMRoEdGVzdCIJGQAAAAAAAPQ/IgkZAAAAAAAA/D8o
+gCB4Ag==
More information about the postgis-tickets
mailing list