0

我需要翻译这个 PostGIS 查询:

SELECT boundary
        ST_Intersects(ST_SetSRID(ST_Buffer(ST_MakePoint(11.255492,43.779251),0.002), 4326), ST_GeomFromKML(boundary)) as intersect,
FROM 
    mytable 
WHERE 
        ST_Intersects(ST_SetSRID(ST_Buffer( ST_MakePoint(11.255492,43.779251),0.002), 4326), ST_GeomFromKML(boundary))
LIMIT 1

到带有空间数据的 MySQL。

我试过这个,但它不工作:

SELECT 
    boundary, 
    ST_Intersects(Buffer('POINT(11.7094335,44.2754631)', 2), GeomFromText(boundary)) as intersect
FROM 
    mytable 
WHERE 
    ST_Intersects(Buffer('POINT(11.7094335,44.2754631)', 2), GeomFromText(boundary))

MySQLboundary列包含以下格式的数据:

POLYGON((11.752094222227 44.322710250414,11.753712975677 44.322710250414,11.753712975677 44.321900873689,11.752094222227 44.321900873689,11.752094222227 44.322710250414))

我究竟做错了什么?

4

1 回答 1

1

我通过反复尝试找到了答案......这解决了问题:

SELECT 
        boundary, 
        ST_Intersects(GEOMFROMTEXT(boundary), ST_Buffer(POINT(11.752094222227, 44.322710250414), 2)) as intersect
FROM 
        mytable 
WHERE  
        ST_Intersects(GEOMFROMTEXT(boundary), ST_Buffer(POINT(11.752094222227, 44.322710250414), 2))

我希望这对未来的用户有用。

于 2020-01-06T14:42:12.433 回答