英文:
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:
在您的数据库中存储了纬度和经度坐标:
- 在您的数据库中查找所有商店及其坐标。
- 计算到给定点的距离,并将距离映射到商店;这些数学公式可能会有帮助:https://www.movable-type.co.uk/scripts/latlong.html
- 过滤距离小于给定 R 的商店。
英文:
Given you have latitude and longitude coordinates stored in your database:
- Find all stores and their coodrdinates in your database.
- 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
- Filter stores with distance closer than your given R.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论