Opened 3 years ago

Last modified 3 months ago

#3705 new defect

ST_AsX3D needs improvement

Reported by: Mike Taves Owned by: robe
Priority: medium Milestone: PostGIS Fund Me
Component: postgis Version: 2.3.x
Keywords: Cc:

Description

Testing ST_AsX3D on various geometries gives varied and interesting results with PostGIS 2.3 on Windows. These are non-critical outputs, separated from critical outputs in #3704

Some are documented not to be implemented, however they still run without raising a "'X' geometry type not implemented" error. The documentation should also mention that M-coordinates (where present) are dropped.

SELECT ST_AsX3D('POLYGON EMPTY');
returns invalid XML: <IndexedFaceSet convex='false' coordIndex=''>' />
SELECT ST_AsX3D('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))');
returns invalid XML: <IndexedFaceSet convex='false' coordIndex='0 1 2 3'>30 10 40 40 20 40 10 20 ' />, and similar for empty and non-empty MULTIPOLYGON
SELECT ST_AsX3D('MULTILINESTRING ((2 3, 4 5))');
returns invalid XML: <IndexedLineSet coordIndex='0 1'>2 3 4 5 ' />

With the following, valid XML is returned (I can't confirm if these are valid X3D):

  • POINT(1 2) : 1 2
  • LINESTRING(1 2, 3 4) : <LineSet vertexCount='2'><Coordinate point='1 2 3 4' /></LineSet>
  • MULTIPOINT EMPTY : <Polypoint2D point='' />
  • TRIANGLE((0 0 0,0 1 0,1 1 0,0 0 0)) : 0 0 0 0 1 0 1 1 0
  • TIN (((0 0 0, 0 0 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 0 0 0))) : <IndexedTriangleSet index='0 1 2 3 4 5'><Coordinate point='0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 1 0'/></IndexedTriangleSet>
  • POLYHEDRALSURFACE Z (((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),((0 0 0, 0 1 0, 0 1 1, 0 0 1, 0 0 0)),((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),((1 1 1, 1 0 1, 0 0 1, 0 1 1, 1 1 1)),((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)),((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1))) : <IndexedFaceSet convex='false' coordIndex='0 1 2 3 -1 4 5 6 7 -1 8 9 10 11 -1 12 13 14 15 -1 16 17 18 19 -1 20 21 22 23'><Coordinate point='0 0 0 0 1 0 1 1 0 1 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 0 1 0 0 1 0 1 0 0 1 1 1 1 1 0 1 0 0 1 0 1 1 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 1 1 0 0 1 0 0 1 1' /></IndexedFaceSet>

However some of these don't work within a GEOMETRYCOLLECTION (the documentation does not indicate the support level of this geometry type):

SELECT ST_AsX3D('GEOMETRYCOLLECTION(POINT(1 2),LINESTRING(1 2, 3 4))');
returns invalid XML: <Shape>1 2<Shape><LineSet vertexCount='2'><Coordinate point='1 2 3 4' /></LineSet>

or

SELECT ST_AsX3D('GEOMETRYCOLLECTION(POINT(1 2),POINT(3 4))');
returns invalid XML: <Shape>1 2<Shape>3 4

Change History (6)

comment:1 Changed 3 years ago by robe

Owner: changed from pramsey to robe

comment:2 Changed 2 years ago by robe

Milestone: PostGIS 2.3.3PostGIS 2.4.0

comment:3 Changed 2 years ago by robe

Milestone: PostGIS 2.4.0PostGIS 2.5.0

comment:4 Changed 16 months ago by robe

Milestone: PostGIS 2.5.0PostGIS next

comment:5 Changed 15 months ago by robe

Milestone: PostGIS nextPostGIS 3.0.0

Milestone renamed

comment:6 Changed 3 months ago by robe

Milestone: PostGIS 3.0.0PostGIS Fund Me
Note: See TracTickets for help on using tickets.