沿着经度然后纬度而不是圆形半径对mysql表上的结果进行排序
嘿大家... 我的任务是进行一个全球搜索项目。 他们想要搜索图片数据库,所有图片都带有长/纬度 mysql 数据库中每个图像的引用记录。
然而,他们的搜索标准有点具体。
一个简化的表结构是: id
INT auto inc 主要 图像路径 varchar 255 长
十进制 12,7 lat
DECIMAL 12,7
我需要为 SQL 语句提供起始长/纬度位置。 然后他们想要接收 34 张图像,从最初的图像向南移动 长参考..一旦他们到达-90(地球底部)就会弹出 向右/向东超过 1 度并向北搜索至 90 度 重复直到找到 34 个图像。
让我困惑的是如何计算减号到加号的变化。 确保我们沿着地球的“长”参考线上下循环。
以前有人这样做过吗..? 我很想在一个查询中完成它...... (我已经看到如何根据圆半径获取结果,但我的客户..祝福他们..不想这样做)
好吧,回到谷歌!
想法……
特里斯……
Hey all...
I've been tasked with a global search project.
They want to search a database of pictures, all with long/lat
references storied per image in a mysql DB.
However, their search criteria is a little specific.
A simplified table structure is:id
INT auto inc primaryimagePath
varchar 255long
DECIMAL 12,7lat
DECIMAL 12,7
I need to provide the SQL statement with a start long/lat position.
They then want to receive 34 images, going south from their initial
long reference.. once they get to -90 (the bottom of the earth) to pop
over 1 degree to the right/East and search up to the north to 90 and
repeat until 34 images are found.
What's confusing me is how to calculate the minus to plus changes..
ensuring that we loop up and down along the earths 'long' reference.
Has anyone done this before..?
I'd LOVE to do it in a single query...
(I've seen how one can fetch results based on a circle radius, but my client.. bless em.. doesn't want to do that)
Ok, back to google!!
Thoughts...
Tris...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
输入是 $the_lat 和 $the_long
按原样,这是一个单向搜索 - 它不会回绕到 longs < $the_long。
Inputs are $the_lat and $the_long
As is, it's a uni-directional search -- it won't wrap around to longs < $the_long.