Database Reference
In-Depth Information
Exporting models as X3D for the Web
Entering3DdatainaPostGISdatabaseisnotnearlyasinterestingifwehavenoca-
pacityforextractingthedatabackoutinsomeusableform.Onewaytoapproachthis
problem is to leverage thePostGIS ability to write 3D tables to the X3D format.
X3DisanXMLstandardfordisplaying3DdataandworkswellviatheWeb.Forthose
familiar with Virtual Reality Modeling Language ( VRML ), X3D is the next genera-
tion of that.
ToviewX3Dinthebrowser,auserhasthechoiceofavarietyofpluginsortheycan
leverageJavaScriptAPIstoenableviewing.Wewillperformthelatter,asitrequires
no user configuration to work. We will use X3DOM's framework to accomplish this.
X3DOMisademonstrationoftheintegrationofHTML5and3DandusesWebGL( ht-
tps://www.khronos.org/webgl/ ) toallowfortherenderingandinteractionwith3Dcon-
tent in the browser. This means that our data will not get displayed in browsers that
are not WebGL compatible. So, we trade off convenience here for some amount of
universality available to us with X3D plugins.
Getting ready
We will be using the point cloud from the previous example to serve in X3D format.
PostGISdocumentationonX3Dincludesanexampleofusingthe ST_AsX3D function
to output the formatted X3D code. That is similar to the this:
SELECT '
<X3D xmlns="http://www.web3d.org/specifications/
x3d-namespace" showStat="false" showLog="false"
x="0px" y="0px" width="800px" height="600px">
<Scene>
<Transform>
<Shape>' || ST_AsX3D(ST_Union(the_geom))
||
'</Shape>
</Transform>
</Scene>
Search WWH ::




Custom Search