Opened 5 years ago

Closed 5 years ago

#4292 closed defect (fixed)

Attribute properties are rounded to whole numbers in ST_AsMVT

Reported by: joedjc Owned by: Algunenano
Priority: medium Milestone: PostGIS 2.4.7
Component: postgis Version: 2.4.x
Keywords: Cc:

Description

If I add a decimal number as a feature-attribute value it seems to be rounded to a whole number in the tile output.

For example:

SELECT ST_AsMVT(q, 'test', 4096, 'geom') FROM 
(
	SELECT 1 AS c1,
	ST_AsMVTGeom(ST_GeomFromText('POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30))'),
	ST_MakeBox2D(ST_Point(0, 0), ST_Point(4096, 4096)), 4096, 0, false) AS geom, 
	'{"test": 0.75}'::jsonb as properties
) AS q;

Change History (5)

comment:1 by Algunenano, 5 years ago

Milestone: PostGIS 2.5.2PostGIS 2.4.7
Owner: changed from pramsey to Algunenano

Can confirm this is present in trunk too:

SELECT 'J4', encode(ST_AsMVT(q, 'test', 4096, 'geom'), 'base64') FROM (
	SELECT 1.25 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;
J4       | GjEKBHRlc3QSDhIEAAABARgBIgQJAIBAGgJjMRoEdGVzdCIGCgQxLjI1IgIoASiAIHgC
echo -n "GjEKBHRlc3QSDhIEAAABARgBIgQJAIBAGgJjMRoEdGVzdCIGCgQxLjI1IgIoASiAIHgC" | base64 -d > /tmp/a.mvt
[
  {
    "name": "test",
    "extent": 4096,
    "version": 2,
    "features": [
      {
        "type": 1,
        "properties": {
          "c1": "1.25",
          "test": 1
        },
        "geometry": [
          9,
          0,
          8192
        ]
      }
    ]
  }
]

comment:3 by Raul Marin, 5 years ago

In 17134:

ST_AsMVT: parse JSON numeric values with decimals as doubles

References #4292
Closes https://github.com/postgis/postgis/pull/357

comment:4 by Raul Marin, 5 years ago

In 17135:

ST_AsMVT: parse JSON numeric values with decimals as doubles

References #4292

comment:5 by Raul Marin, 5 years ago

Resolution: fixed
Status: newclosed

In 17136:

ST_AsMVT: parse JSON numeric values with decimals as doubles

Closes #4292

Note: See TracTickets for help on using tickets.