backend: geocoding support for warhelp dataset
This commit is contained in:
parent
330046b55f
commit
e31d2cfb92
|
@ -6,9 +6,14 @@
|
|||
[beherbergung.model.ngo :as ngo]))
|
||||
|
||||
(defn geocode [record]
|
||||
(let [params {:city (:place_city record)}
|
||||
result (client/get "https://nominatim.openstreetmap.org/search?format=json&limit=1"
|
||||
{:accept :json :as :json :query-params params})
|
||||
(let [params (cond (not-empty (:place_city record))
|
||||
{:city (:place_city record)}
|
||||
(not-empty (:place_str record))
|
||||
{:q (:place_str record)})
|
||||
result (when params
|
||||
(prn params)
|
||||
(client/get "https://nominatim.openstreetmap.org/search?format=json&limit=1"
|
||||
{:accept :json :as :json :query-params params}))
|
||||
result_ok (when (= 200 (:status result))
|
||||
(first (:body result)))]
|
||||
(println (or (:display_name result_ok)
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
[beherbergung.model.offer-mapping.warhelp]))
|
||||
|
||||
(defn importfile->table [file]
|
||||
(take 5 (unify (clojure.edn/read-string (slurp file)) ;; TODO all
|
||||
beherbergung.model.offer-mapping.warhelp/mapping)))
|
||||
(unify (clojure.edn/read-string (slurp file))
|
||||
beherbergung.model.offer-mapping.warhelp/mapping))
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
:place_zip (constantly nil)
|
||||
:place_street (constantly nil)
|
||||
:place_street_number (constantly nil)
|
||||
:place_str #(or (not-empty (get % "Address (+ zip code!)"))
|
||||
(get % "Address (+ zip code!) / Adresse (+ PLZ)"))
|
||||
|
||||
:accessible (constantly nil)
|
||||
:animals_allowed (constantly nil)
|
||||
|
|
Loading…
Reference in New Issue