当前位置: 代码迷 >> MySQL >> 使用mysql空间索引,搜寻附近的坐标地址并按距离排序
  详细解决方案

使用mysql空间索引,搜寻附近的坐标地址并按距离排序

热度:254   发布时间:2016-05-05 16:32:40.0
使用mysql空间索引,搜索附近的坐标地址并按距离排序
SELECT	address,X(address_loc),Y(address_loc)FROM	addressWHERE	MBRContains (		LineString (			Point (				30.620076 + 10 / (					111.1 / COS(RADIANS(104.067221))				),				104.067221 + 10 / 111.1			),			Point (				30.620076 - 10 / (					111.1 / COS(RADIANS(104.067221))				),				104.067221 - 10 / 111.1			)		),		address_loc	)ORDER BY (power(ABS(30.620076-X(address_loc)),2) + power(ABS(104.067221-Y(address_loc)),2));
  相关解决方案