Opened 7 years ago

Last modified 5 years 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 by robe, 7 years ago

Owner: changed from pramsey to robe

comment:2 by robe, 7 years ago

Milestone: PostGIS 2.3.3PostGIS 2.4.0

comment:3 by robe, 7 years ago

Milestone: PostGIS 2.4.0PostGIS 2.5.0

comment:4 by robe, 6 years ago

Milestone: PostGIS 2.5.0PostGIS next

comment:5 by robe, 6 years ago

Milestone: PostGIS nextPostGIS 3.0.0

Milestone renamed

comment:6 by robe, 5 years ago

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