-﻿-- ENVELOPE.sql
+-- ENVELOPE.sql
 --
 -- Authors:     Felix Kunde <fkunde@virtualcitysystems.de>
 --              Claus Nagel <cnagel@virtualcitysystems.de>
 --
 -- Copyright:   (c) 2012-2015  Chair of Geoinformatics,
---                             Technische Universitaet Muenchen, Germany
+--                             Technische Universitt Mnchen, Germany
 --                             http://www.gis.bv.tum.de
 --
 -------------------------------------------------------------------------------
 -- About:
--- This script provides functions to get an object's envelope (a diagonal cutting plane
--- inside a 3D bounding box).
+-- This script provides functions to calculate an object's envelope 
+-- (a diagonal cutting plane inside a 3D bounding box) and to store
+-- the result in the ENVELOPE column of CITYOBJECT
 --
 -------------------------------------------------------------------------------
 --

* @param        @description
* co_id         identifier for city object group
* set_envelope  if 1 (default = 0) the envelope column is updated
* schema_name   name of schema
*
* @return

  query TEXT;
  envelope GEOMETRY;
BEGIN
  IF calc_member_envelopes <> 0 THEN
    EXECUTE format(
      'WITH collect_geom AS (
         -- cityobjectgroup geometry
