Commit 876aa76d authored by Raúl Marín's avatar Raúl Marín

ST_AsMVT: parse JSON numeric values with decimals as doubles

References #4292



git-svn-id: http://svn.osgeo.org/postgis/branches/2.5@17135 b70326c6-7e19-0410-871a-916f4a2858ee
parent 6e21e3b6
Pipeline #43000614 passed with stage
in 22 minutes and 26 seconds
......@@ -23,10 +23,11 @@ XXXX/XX/XX
- #4267, Enable Proj 6 deprecated APIs (Darafei Praliaskouski, Raúl Marín)
- #4276, ST_AsGeoJSON documentation refresh (Darafei Praliaskouski)
- #4276, ST_AsGeoJSON documentation refresh (Darafei Praliaskouski)
- #4273, Tighter parsing of WKT (Paul Ramsey)
- #4292, ST_AsMVT: parse JSON numeric values with decimals as doubles (Raúl Marín)
PostGIS 2.5.1
2018/11/18
......
......@@ -608,7 +608,7 @@ static uint32_t *parse_jsonb(mvt_agg_context *ctx, Jsonb *jb,
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));
......
......@@ -11,3 +11,9 @@ SELECT 'J3', encode(ST_AsMVT(q, 'test', 4096, 'geom'), 'base64') FROM (
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
......@@ -2,3 +2,5 @@ J1|Gi8KBHRlc3QSDhIEAAABARgBIgQJMt4/GgJjMRoCYzIiAigBIgYKBGFiY2QogCB4Ag==
J2|GisKBHRlc3QSDhIEAAABABgBIgQJMt4/GgJjMRoCYzIiBgoEYWJjZCiAIHgC
J3|GlAKBHRlc3QSDhIEAAABABgBIgQJMt4/Eg4SBAABAgIYASIECTLePxoCYzEaAmMyGgJjMyIGCgRh
YmNkIgIoBSILCglhYmFzZGFkY2QogCB4Ag==
J4|GjsKBHRlc3QSDhIEAAABARgBIgQJAIBAGgJjMRoEdGVzdCIJGQAAAAAAAPQ/IgkZAAAAAAAA/D8o
gCB4Ag==
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment