android要做附近商家显示,显示多少米范围内商家,php数据库如何设计坐标的

WBOY
Release: 2016-06-13 12:50:29
Original
755 people have browsed it

android要做附近商家显示,显示多少米范围内商家,php数据库怎么设计坐标的
android要做附近商家显示,显示多少米范围内商家,php数据库怎么设计坐标的


------解决方案--------------------
最少是需要 经度 纬度 这两个字段~ 然后通过php或者java算出某个点的经度和纬度为中心 xx米 为半径的 最大和最小的 经度和纬度 这样就能得到四个坐标点 通过四个坐标点sql查询符合条件的经度和纬度的商铺,当然这样算出的 是一个四边形的范围 ! 圆形的 比较麻烦!
------解决方案--------------------
不是 多少米范围内有商家
而是 商家在多少米范围内

虽然看上去是一样的,但是主体变化了
商家是主体,他的位置是固定的,他不会因为你的移动而移到
你只需保存商家的坐标就可以了
------解决方案--------------------
孩子 mysql本身就有这种字段
------解决方案--------------------
记录每个商家的经度和纬度就可以了

然后计算当前位置与各个商家之间的距离

再在mysql里面建立一个计算距离的函数 就可以用SQL语句查询了
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!