mysql query points within polygon - no results

半城伤御伤魂 提交于 2019-12-03 06:03:24

As documented under Class Polygon (emphasis added):

Polygon Assertions

  • The boundary of a Polygon consists of a set of LinearRing objects (that is, LineString objects that are both simple and closed) that make up its exterior and interior boundaries.

You must therefore close the polygon by finishing at the starting point:

SELECT *, AsText(location) FROM stuff 
 WHERE Contains(
 GeomFromText('POLYGON((41.000497 -109.050149, 41.002380 -102.051881, 36.993237 -102.041959, 36.999037 -109.045220, 41.000497 -109.050149))'), location );

See it on sqlfiddle.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!