我正在处理一个查询,该查询获取纬度和经度在给定多边形内的所有行。我正在使用几何函数来做到这一点。我可以使用包含多边形和点的方法,但是在我的情况下,我在查询中明确使用多边形坐标,并希望使用“纬度”和“经度”列名作为 POINT 的参数。我尝试使用 concat 方法,但我从 contains 方法得到“错误”返回。
询问:
SELECT
*
from table
WHERE
contains(
GeomFromText(
'POLYGON(
(32.717399 -117.144126,32.714655 -117.136487,32.710827 -117.145843,32.714005 -117.146444, 32.717399 -117.144126))
'),
GeomFromText(
'POINT(
concate(latitude," ",longitude))
'))
我的表结构是:
property_id int(11)
latitude decimal(10,6)
longitude decimal(10,6)
Address_f1365 char(100)
AddressOnTheInternet_f27 char(255)