ST_AsX3D

更新时间:
复制 MD 格式

Returns the Extensible 3D (X3D) 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.Required
maxdecimaldigitsintegerThe maximum number of decimal places in the output coordinates.15
optionsintegerControls coordinate order and GeoCoordinates output. See Options.0

Options

ValueBehavior
0Returns x and y coordinates in database order (default).
1Flips x and y coordinates. When combined with the GeoCoordinates option, applies latitude_first by default.
2Returns coordinates in GeoSpatial GeoCoordinates order. The geometry must use WGS 84 (SRID 4326); otherwise the function returns an error. Output: GeoCoordinate geoSystem='"GD" "WE" "longitude_first"'.
3Returns the X3D string using GeoCoordinate geoSystem='"GD" "WE" "latitude_first"'.

Description

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

Examples

Convert a 3D polygon to an X3D IndexedFaceSet node:

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

Output:

<IndexedFaceSet  convex='false' coordIndex='0 1 2 3'>
    <Coordinate point='1 1 0 1 2 0 2 2 0 2 1 0 ' />
</IndexedFaceSet>