                                      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

  )
)

(defn shape-aggregagation-popup-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)
  )
)


          (get layer "shapeLabelColumn"))))
)

(defn shape-aggregation-cartocss [layer-index layer]
  (cond-> (format "#s {
              polygon-opacity: 0.8;
              polygon-fill: [shapefill];
              line-width: 0.5;
              line-color: rgba(0,0,0,0.3);
           }
           "
          (layer-point-color layer-index))
          (get layer "shapeLabelColumn")
          (str (format "#s::labels {
            text-name: [%s];
            text-face-name: 'DejaVu Sans Book';
            text-size: 10;
            text-fill: #000;
          }"
          (get layer "shapeLabelColumn"))))
)

(defn cartocss [layer layer-index metadata-array]
  (cond
    (and (get layer "aggregationDataset")(get layer "aggregationColumn")(get layer "aggregationGeomColumn"))
    (shape-aggregation-cartocss layer-index layer)

    (= (get layer "layerType") "geo-shape")
    (shape-cartocss layer-index layer)
