Works in filesystem and from jar. Updated docs to recognise that the scale-and-zoom issue is fixed.
This commit is contained in:
Simon Brooke 2020-01-29 20:28:12 +00:00
parent 5ded76199f
commit f8c05e5668
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
5 changed files with 11 additions and 18 deletions

View file

@ -54,10 +54,6 @@ GeoCSV is at an early stage of development, and some features are not yet workin
At the current stage of development, if no appropriate image exists in the `resources/public/img/map-pins` folder, that's your problem. **TODO:** I intend at some point to make missing pin images default to `unknown-pin.png`, which does exist.
### Doesn't scale and centre the map to show the data in the sheet
Currently the map is initially centred roughly on the centre of Scotland, and scaled arbitrarily. It should compute an appropriate centre and scale from the data provided, but currently doesn't.
## Prerequisites
You will need [Leiningen][1] 2.0 or above installed.

View file

@ -1,5 +1,5 @@
(ns geocsv.app
(:require [geocsv.core :as core]))
(:require [geocsv.client.core :as core]))
;;ignore println statements in prod
(set! *print-fn* (fn [& _]))

View file

@ -12,6 +12,7 @@
[com.cemerick/url "0.1.1"]
[com.cognitect/transit-clj "0.8.319"]
[compojure "1.6.1"]
[cpath-clj "0.1.2"]
[cprop "0.1.15"]
[csv2edn "0.1.6"]
[day8.re-frame/http-fx "0.1.6"]

View file

@ -54,10 +54,6 @@ GeoCSV is at an early stage of development, and some features are not yet workin
At the current stage of development, if no appropriate image exists in the `resources/public/img/map-pins` folder, that's your problem. **TODO:** I intend at some point to make missing pin images default to `unknown-pin.png`, which does exist.
### Doesn't scale and centre the map to show the data in the sheet
Currently the map is initially centred roughly on the centre of Scotland, and scaled arbitrarily. It should compute an appropriate centre and scale from the data provided, but currently doesn't.
## Prerequisites
You will need [Leiningen][1] 2.0 or above installed.

View file

@ -6,6 +6,7 @@
[clojure.java.io :as io]
[clojure.string :as s]
[clojure.tools.logging :as log]
[cpath-clj.core :as cp]
[compojure.core :refer [defroutes GET POST]]
[csv2edn.csv2edn :refer :all]
[noir.response :as nresponse]
@ -37,19 +38,18 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn get-pin-image-names
"Return the category names for which we have pin images; `request` is ignored.
This looks odd - why not file-seq over the directory? - but the answer is we
may be running in a jar file, and if we are that will fail."
[request]
(ar/do-or-server-fail
(map
#(s/replace (.getName %) #"-pin\.png$" "")
(let [grammar-matcher (.getPathMatcher
(java.nio.file.FileSystems/getDefault)
"glob:*-pin.png")]
#(s/replace (s/replace (str %) #"-pin\.png$" "") "/" "")
(->> "public/img/map-pins"
io/resource
io/file
file-seq
(filter #(.isFile %))
(filter #(.matches grammar-matcher (.getFileName (.toPath %)))))))
cp/resources
keys
(filter #(re-find #".*-pin.png" %))))
200))
(defn get-data-uri