postgresql - 如何从 clojureql 查询 postgres Point 类型?

标签 postgresql clojure spatial postgis

如何从 clojureql 查询 postgres Point 类型?我希望使用 PostGIS 功能,但 clojureql 似乎不包含此功能。

最佳答案

我不是 clojureql 的专家,但如果这个语法是正确的:

(with-connection db 
   (with-query-results rs ["select * from blogs"] 
     ; rs will be a sequence of maps, 
     ; one for each record in the result set. 
     (dorun (map #(println (:title %)) rs))))

(取自here)

为什么不尝试将 rs 更改为:

select point[0] as x, point[1] as y from table

这行得通吗?我不确定是否会这样,但是如果这种 Clojure 查询方式只是将查询转发到数据库“asis”,您也可以尝试在其中使用 PostGIS 运算符。

关于postgresql - 如何从 clojureql 查询 postgres Point 类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6642695/

相关文章:

postgresql - 拆分数组,仅提取唯一值,然后重新合并到 Postgresql 中的数组

postgresql - psql 致命角色不存在

postgresql - 转义 hstore 包含 JDBC 准备语句中的运算符

haskell - 幺半群和环之间的差异意味着什么?

arrays - 在 Clojure 中从类型特定数组创建通用数组

java - 如何从点创建多边形 (Spatial4j)

Postgresql:获取jsonb列的所有最外键

sql - 如何使用 Clojure JDBC 插入 Postgres 枚举值?

c# - 如何在 C# WPF 中的 SQL Server 2012 中存储 Circle 的空间数据

r - 如何加快从栅格中提取缓冲区中土地覆盖类型的比例?