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
| Parameter | Type | Description | Default |
|---|---|---|---|
g1 | geometry | The geometry object to convert. | Required |
maxdecimaldigits | integer | The maximum number of decimal places in the output coordinates. | 15 |
options | integer | Controls coordinate order and GeoCoordinates output. See Options. | 0 |
Options
| Value | Behavior |
|---|---|
0 | Returns x and y coordinates in database order (default). |
1 | Flips x and y coordinates. When combined with the GeoCoordinates option, applies latitude_first by default. |
2 | Returns 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"'. |
3 | Returns 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>该文章对您有帮助吗?