[英]MySQL POLYGON query no results
具有POINT数据类型的数据库表。 我无法从MySQL POLYGON查询中获得任何结果。 知道我做错了什么吗? 多边形已关闭。
id location
1 POINT(-37.816652 144.964595)
2 POINT(-37.788132 144.931183)
3 POINT(-37.811291 144.985916)
4 POINT(-37.8389571 144.9656531000001)
5 POINT(-37.851038 144.993205)
6 POINT(-37.8029679 144.9501126)
/*
north = -37.711586434367305
east = 145.45740074179685
south = -37.92854972934211
west = 144.6142000582031
*/
SELECT * FROM `properties` WHERE Contains (GeomFromText('POLYGON((145.45740074179685, -37.711586434367305, 144.6142000582031, -37.711586434367305, 144.6142000582031, -37.92854972934211, 145.45740074179685, -37.92854972934211, 145.45740074179685, -37.711586434367305))'), location)
SELECT * FROM `properties` WHERE Contains (PolygonFromText('POLYGON((145.45740074179685, -37.711586434367305, 144.6142000582031, -37.711586434367305, 144.6142000582031, -37.92854972934211, 145.45740074179685, -37.92854972934211, 145.45740074179685, -37.711586434367305))'), location)
你好像让你的坐在错误的顺序。
GeomFromText('POLYGON((-37.711586434367305,145.45740074179685,
-37.711586434367305, 144.6142000582031, ....)))
另外,Contains已被弃用。 更好地使用MBRContains。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.