 (om/root sensors-view app-state
   {:target (. js/document (getElementById "sensors"))})
 
-(defn draw-map [canvas mapImage]
-	(set! (.-width canvas) (.-width mapImage))
-	(set! (.-height canvas) (.-height mapImage))
-	(let [context (.getContext canvas "2d")]
-		(.drawImage context mapImage 0 0)
-		(set! (.-fillStyle context) "#ff0000")
-		(.fillRect context 100 100 10 10)
-	)
-)
-
-(def canvas-dom (.getElementById js/document "map"))
-
 (defn map-image []
 	(let [img (js/Image.)]
 		(set! (.-src img) "map.png")

       (send (str "http://" (cljs-env :es-host "localhost") ":9200/" log "/_search") "POST" payload))
	   ))

(defn parse-nodes [node-data node-key]
    (let [
        buckets (-> node-data :aggregations :group_by_state :buckets)

        (.log js/console "nodes" (pr-str nodes))
        (swap! app-state assoc node-key nodes)
		(swap! app-state assoc :nodes (merge (:old-nodes @app-state) (:new-nodes @app-state)))
		(draw-map canvas-dom (:map @app-state))
    )
)

