可以有人建议我如何使用Spring从MySQL数据库中进行基于位置的搜索吗?

huangapple go评论78阅读模式
英文:

Can anyone suggest me how to do a location based search from MySQL database using Spring?

问题

我想从商店的数据库中获取若干行数据(假设如此),根据特定的点(纬度、经度)和该点周围的半径(假设为R)来进行。我正在使用Spring Boot和Spring Data JPA,以及MySQL作为数据库。

您能否提供一些技术或Spring的一些功能,可以帮助我实现这一目标呢?

英文:

I want to fetch several row data from the database of stores(let's say) according to a particular point(latitude, longitude) and a radius(let's say R) around that point. I am using Spring Boot and Spring Data JPA and MySql as database.

Can you suggest some technology or some feature of spring which will allow me to achieve this?

答案1

得分: 0

Sure, here's the translation:

在您的数据库中存储了纬度和经度坐标:

  1. 在您的数据库中查找所有商店及其坐标。
  2. 计算到给定点的距离,并将距离映射到商店;这些数学公式可能会有帮助:https://www.movable-type.co.uk/scripts/latlong.html
  3. 过滤距离小于给定 R 的商店。
英文:

Given you have latitude and longitude coordinates stored in your database:

  1. Find all stores and their coodrdinates in your database.
  2. Calculate distance to your given point and map the distance to your stores; these math formulas might be helpful: https://www.movable-type.co.uk/scripts/latlong.html
  3. Filter stores with distance closer than your given R.

huangapple
  • 本文由 发表于 2020年9月17日 21:12:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/63938797.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定