There's more...

One might want to use this X3D conversion as a function, feeding geometry into a function and getting a page in return. In this way, we can reuse the code easily for other tables. Embodied in a function, X3D conversion is as follows:

CREATE OR REPLACE FUNCTION AsX3D_XHTML(geometry)
RETURNS character varying AS
$BODY$
    
SELECT regexp_replace(
  '
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns= "http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="X-UA-Compatible" content="chrome=1"/>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
        <title>Point Cloud in a Browser</title>
        <link rel="stylesheet" type="text/css"         href="http://x3dom.org/x3dom/example/x3dom.css ...

Get PostGIS Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.