java - 如何在spring-boot中使用pologon postgis查询
问题描述
执行以下查询时出现此异常 我使用 postgis 如何以正确的方式使用 pologon
无法提取结果集;SQL [不适用];嵌套异常是 org.hibernate.exception.SQLGrammarException: could not extract ResultSet
@Query(name = "getCellIdsForRectangle", value = "SELECT * FROM lk_location as lk "
+ "LEFT JOIN lk_slocation as s "
+ "ON ST_DWithin(POLYGON((-4.43 54.31,-4.39 54.31,-4.39 54.29,-4.43 54.29,-4.43 54.31))\\:\\:GEOMETRY, ST_MakePoint(s.longitude,s.latitude)\\:\\:geometry, s.range) "
+ "WHERE ST_DWithin(POLYGON((-4.43 54.31,-4.39 54.31,-4.39 54.29,-4.43 54.29,-4.43 54.31))\\:\\:GEOMETRY, ST_MakePoint(lk.longitude,lk.latitude)\\:\\:geometry, lk.range) AND s.location_id IS NULL;", nativeQuery = true)
List<Location> getCellIdsForRectangle();
解决方案
您正在从文本构造一个多边形,因此必须引用该多边形
+ "ON ST_DWithin('POLYGON((-4.43 54.31,-4.39 54.31,-4.39 54.29,-4.43 54.29,-4.43 54.31))'\\:\\:GEOMETRY, ST_MakePoint(s.longitude,s.latitude)\\:\\:geometry, s.range) "
推荐阅读
- php - 如何正确挂钩以自定义我的 WooCommerce 商店页面?
- java - 无法注册 bean 'exampleService.FeignClientSpecification'。Bean 已定义且覆盖已禁用
- python - Glove6b50d 解析:无法将字符串转换为浮点数:'-'
- angular - ngOnchanges 和 DoCheck 角度
- node.js - 如何使用nodejs代码删除excelsheet单元格中的所有空格
- node.js - 如何在节点js中获取用户的所有数据
- javascript - 我们如何访问嵌套在 JavaScript 中具有整数属性的对象中的对象值
- python - 将熊猫升级到 1.03 后,熊猫因空数据框而失败是错误还是功能?(TypeError:无法使用 dtyped 执行“rand_”)
- amazon-web-services - 卓:是否可以检索存储在 KMS 中的密钥内容?
- pointers - Fortran 指针的深拷贝