duanjian3338 2012-01-22 03:06
浏览 25
已采纳

PHP MySQL - Levenshtein替代十进制

I have a data set with latitude and longitude coordinates (two separate decimal columns). I need to perform a search on them and order them by proximity, based on a supplied lat/lon coordinate.

I am not opposed to converting the columns to a varchar to perform a match/against search, but I know that the match/against is optimized for words.

What would be the best way to sort coordinates by distance? I can do this via PHP if necessary, though I would prefer to do it at the object layer to reduce server load and load times.

I am currently in the process of testing the match/against approach.

Sum up:

Given -90.23, 13.18 return the closest matching latitude/longitude coordinate pairs in order of proximity.

Sample result:

[1] -90.24, 13.17
[2] -90.18, 12.99
[3] -91.78, 16.98
[4] -90.27, 24.78
  • 写回答

1条回答 默认 最新

  • doulao2029 2012-01-22 04:27
    关注

    There are numerous methods to calculate geographic distance between sets of points. Some are accurate where others are fast. Which method you choose is all depends on your requirements. As there are many answered questions here at Stack Overflow which have specific answers:

    https://stackoverflow.com/search?tab=votes&q=distance%20mysql

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 校园二手交易小程序搭建
  • ¥15 请问在ubuntu用conda创建环境报错怎么能解决
  • ¥15 STM32CubeMX/proteus按键控制指示灯颜色切换
  • ¥20 python,计算区位熵和扩张指数
  • ¥15 Python环境配置
  • ¥15 大四学生的困惑,有偿提问!
  • ¥15 解决页面无法编入索引:被“noindex”标签排除的问题?
  • ¥15 arduino测量电阻
  • ¥15 快手uid转快手号谁能解决 需要开发
  • ¥15 iis部署Django时css不生效,来个真人,ai不好使