ST_AsX3D

更新时间:
复制 MD 格式

Returns the Extensible 3D (X3D) XML representation of a geometry object as a text string.

Syntax

text ST_AsX3D(geometry g1, integer maxdecimaldigits, integer options)

Parameters

ParameterTypeDescriptionDefault
g1geometryThe geometry object to convert.
maxdecimaldigitsintegerThe maximum number of decimal places in the output coordinates.15
optionsintegerSpecifies whether to represent coordinates with the X3D GeoCoordinates Geospatial node and whether to flip the x and y coordinates. See Options for details.0

Options

ValueBehavior
0Returns coordinates in database order (x, y). Default.
1Flips x and y coordinates. When combined with the GeoCoordinates flag (2), applies latitude_first ordering.
2Wraps coordinates in a GeoSpatial GeoCoordinates node. The geometry must use WGS 84 (SRID 4326); other SRIDs cause an error. This is the only GeoCoordinate type that is supported. Specify a spatial reference system based on the X3D specification. Output: GeoCoordinate geoSystem='"GD" "WE" "longitude_first"'.
3Outputs GeoCoordinate geoSystem='"GD" "WE" "latitude_first"'.

Supported geometry types

ST_AsX3D supports circular strings, curves, polyhedral surfaces, triangles, triangulated irregular network (TIN) surfaces, and 3D objects.

Examples

Convert a polygon to X3D

SELECT ST_AsX3D(ST_GeomFromEWKT('POLYGON((1 1 0,1 2 0,2 2 0,2 1 0,1 1 0))'));

Output:

                           st_asx3d
---------------------------------------------------------------
 <IndexedFaceSet  convex='false' coordIndex='0 1 2 3'>
     <Coordinate point='1 1 0 1 2 0 2 2 0 2 1 0 ' />
 </IndexedFaceSet>
(1 row)