且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MBR内在MySQL中不准确

更新时间:2023-12-02 20:43:04

MySQL 5.6.1和更高版本具有精确的几何算法,除了只能在MBR上运行的早期功能.

MySQL 5.6.1 and later have exact geometry algorithms in addition to the earlier functions that only operated on MBR.

您可以使用ST_WITHIN而不是MBR_WITHIN.参见

You can use ST_WITHIN rather than MBR_WITHIN. See documentation. Like this

SELECT ST_Within(GeomFromText('POINT(101.11857 4.34475)'),
  GeomFromText('POLYGON((101.12112522125244 4.3531723687957164,101.11846446990967 
    4.351417913665312,101.13138198852539 4.336397898951581,101.13477230072021 
    4.33211863778494,101.14065170288086 4.321933898868271,101.14992141723633 
    4.306699328215635,101.15455627441406 4.30978050198082,101.1397933959961 
    4.334600612212089,101.12112522125244 4.3531723687957164,101.12112522125244 
    4.3531723687957164))')) As geoFenceStatus