       (str (int (* 360 hue))))
     (catch Exception e "0")))
 
-(defn shape-aggregagation-extra-cols-sql [popup table-name prefix postfix]
+(defn shape-aggregation-extra-cols-sql [popup table-name prefix postfix]
   (if (= (count popup) 0)
     ""
     (str prefix

              row_query.shapeRowNum = %s.rnum
            ;
            "

            (shape-aggregagation-extra-cols-sql extra-cols "row_query" "" ",")
            shape-table-name
            (:geom current-layer )
            (shape-aggregagation-extra-cols-sql extra-cols shape-table-name "" ",")
            shape-table-name
            aggregation-method
            (:aggregationColumn current-layer)
            shape-table-name
            point-table-name
            shape-table-name
            (:geom current-layer)
            (:aggregationGeomColumn current-layer)
            shape-table-name
            (shape-aggregagation-extra-cols-sql extra-cols shape-table-name "," "")
            (shape-aggregagation-extra-cols-sql extra-cols "temp_table" "" ",")
            hue
            shape-table-name
            shape-table-name)))

              %s
              round(_aggregation, 5) as _aggregation,
              shapefill,
              %s
            FROM
              (
                with temp_table as
                  (%s)
                select
                  %s
                  shapeRowNum,
