This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-16
Channels
- # announcements (7)
- # asami (31)
- # aws (9)
- # babashka (29)
- # bangalore-clj (8)
- # beginners (153)
- # calva (4)
- # cider (21)
- # clj-kondo (29)
- # clojure (78)
- # clojure-australia (2)
- # clojure-dev (63)
- # clojure-europe (22)
- # clojure-italy (7)
- # clojure-nl (3)
- # clojure-norway (4)
- # clojure-uk (25)
- # core-async (1)
- # cursive (24)
- # datomic (33)
- # emacs (15)
- # events (2)
- # fulcro (4)
- # girouette (1)
- # google-cloud (2)
- # graphql (14)
- # honeysql (15)
- # instaparse (1)
- # jobs (2)
- # jobs-discuss (2)
- # meander (18)
- # off-topic (100)
- # pathom (48)
- # pedestal (2)
- # polylith (5)
- # practicalli (4)
- # reveal (8)
- # shadow-cljs (3)
- # spacemacs (12)
- # sql (23)
- # tools-deps (1)
- # uncomplicate (1)
- # vim (21)
- # xtdb (19)
Hello! I was looking for a query builder for PostGIS and was directed to HoneySQL. I understand that there is no PostGIS support but might something like this work through JDBC?
(def postgis-map {:select [:city/name :state/name :city/geom]
:from [:city]
:join [:state (sql/raw ["ST_Intersects(" :city/geom ", " :state/geom ")"])]})
(sql/format postgis-map :namespace-as-table? true)
;; => ["SELECT city.name, state.name, city.geom FROM city INNER JOIN state ON ST_Intersects(city.geom, state.geom)"]
Am trying to see if I can compose PostGIS queries by simply using sql/raw
and sql/forma
which seems to work 🙂
Any advice on how I might want to improve my approach to this? And just wondering if there is anything I should be aware of when linking up to JDBC to PostgreSQL + PostGIS (extension)(defn location->st-point
[{:keys [lat lng] :as location}]
[[:ST_SetSRID [:ST_MakePoint (round6 lng) (round6 lat)] [:cast 4326 :integer]]])
On a sidenote, is there a place I can look at the unstable(?) implementation of honeysql v2?
@zackteo Even 1.x supports PostGIS expressions -- there's a section in the README about it: https://github.com/seancorfield/honeysql/#postgis /cc @dharrigan
(and, yes, 2.x makes this even easier)