         (let [keyed (group-by feature-keys collection-features)]
           (doseq [[columns vals] keyed]
             (when (< 0 (count columns))
-              (let [sql (gs-update-sql dataset collection (map name columns))
+              (let [sql (gs-update-sql dataset (visualization dataset collection) (map name columns))
                     update-vals (map feature-to-update-record vals)]
                 (j/execute! db (cons sql update-vals) :multi? true :transaction? false)))))
         ))

  (pg/create-schema db dataset))

(defn- gs-collection-exists? [db dataset collection]
  ;(println "collection exists?")
  (pg/table-exists? db dataset collection))

(defn- gs-create-collection [db dataset collection]
  "Create table with default fields"
  (pg/create-table db dataset collection
                [:gid "serial" :primary :key]
                [:_id "varchar(100)"]
                [:_geometry "geometry"])
  (pg/create-index db dataset collection "_id")
  (pg/add-geo-constraints db dataset collection :_geometry)
  (pg/populate-geometry-columns db dataset collection))

(defn- gs-collection-attributes [db dataset collection]
  ;(println "attributes")

(defn- conj!-when-not-nil [target src & srcs]
  (apply conj!-when target identity src srcs))

(def visualization-table 
  {:bgt {:wegdeel$kruinlijn "kruinlijn"}})

(defn visualization [dataset collection]
  (let [k-collection (keyword collection)
        k-dataset (keyword dataset)]
    (or (get-in visualization-table [k-dataset k-collection] collection))))

(defn- gs-dataset-exists? [db dataset]
  ;(println "dataset exists?")
  (pg/schema-exists? db dataset))
