X3D export




DEFINITION


asx3d() is an export function. X3D is the VRML successor and describes an XML syntax. So it's a 3D format which is fine to use in a web environment.


This function is available for the following geometry :
  • POINT
  • MULTIPOINT
  • LINESTRING
  • MULTILINESTRING
  • POLYGON
  • MULTIPOLYGON
  • TIN
  • POLYHEDRALSURFACE

Here are some example queries of its use :
  • POINT/MULTIPOINT LINESTRING/MULTILINESTRING
___________________________________________________________________

SELECT asx3d('POINT(1 2 3)');

SELECT asx3d('MULTIPOINT(1 2 3, 4 5 6)');

SELECT asx3d('LINESTRING(1 2 3, 4 5 6)');

SELECT asx3d('MULTILINESTRING((1 2 3, 4 5 6), (0 0 0, 5 4 6))');

___________________________________________________________________

  • TIN and POLYHEDRALSURFACE
______________________________________________________________________________________________________________

SELECT asx3d('TIN(((0 0 0, 1 0 0 , 0 1 0, 0 0 0)),((1 0 0, 0 0 1, 0 1 0, 1 0 0)))');

SELECT asx3d('POLYHEDRALSURFACE(((0 0 0, 0 1 0, 1 1 0, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)))');
______________________________________________________________________________________________________________



PGSQL2X3D COMMAND

PGSQL2X3D is a command which creates x3d files by exporting geometries from PostGIS.

Here is the help of this command:

__________________________________________________________________________________________________

USAGE : pgsql2x3d [options] database [schema.]table
pgsql2x3d [options] database subquery

OPTIONS :
-f filename
Use this option to specify the name of the file to create.
If not present, the result will be printed on stdout.
-h host
Allows you to specify connection to a database on a machine other than the default.
-p port
Allows you to specify a database port other than the default.
-P password
Connect to the database with the specified password.
-u user
Connect to the database as the specified user.
-g geometry_column
Specify the geometry column to be exported. This option is necessary.
-t texture_name_column
Specify the texture name column to be exported.
-uv texture_coordinates
Specify the texture coordinates column to be exported.
!!!: If one of -t or -uv option is given, the other one must be given too.
-pos position
Specify the observator's position at the beginning.
-gc ground_color
Specify the ground color. (for example : '-gc 0.34 0.7 0.98')
-sc sky_color
Specify the sky color.
-fc faces_color
Specify the color of faces which are not textured.
-?
Display this help screen.


Beware :
If you give a subquery instead of a table name in parameter, the -g -t and -uv options must be the names of the alias you give in the subquery.
Example :
pgsql2x3d -g geom -t tex -uv uvcoord -f testfile mydatabase 'SELECT ST_RotateX(the_geom, 2)
AS geom, the_texture AS tex, coorduv AS uvcoord from mytable'
___________________________________________________________________________________________________



EXAMPLES :

Later...