                                      c)) popup-columns) geom-column)
                 point-color-column (conj point-color-column)))
     hue (color-to-hue (clojure.string/upper-case (get current-layer "gradientColor" "#FF0000")))
+    extra-cols (popup-and-label-cols (get current-layer "popup") (get current-layer "shapeLabelColumn"))
     ]
 
     (format "with temp_table as

              temp_table;
            "

            (shape-aggregagation-popup-sql (get current-layer "popup") shape-table-name "" ",")
            shape-table-name
            (get current-layer "geom")
            aggregation-method

  )
)

(defn shape-aggregagation-extra-cols-sql [popup table-name prefix postfix]
  (if
    (= (count popup) 0)
    ""
    (str prefix (clojure.string/join "," (map (fn [popupObj] (str table-name "." (get popupObj "column"))) popup)) postfix)
  )
)

(defn popup-and-label-cols [popup-cols label-col]
  (cond
    (and (boolean popup-cols) (boolean label-col))
    (conj popup-cols {"column" label-col})

    (boolean popup-cols)
    popup-cols

    (boolean label-col)
    [{"column" label-col}]

    :else
    []
  )
)

