gpt4 book ai didi

mysql - MBR 内在 mysql 中不准确

转载 作者:可可西里 更新时间:2023-11-01 07:54:19 24 4
gpt4 key购买 nike

我已经使用 MBRWithin 函数很多次了。突然我在谷歌地图上注意到这个 POINT(101.11857 4.34475) 超出了我指定的地理围栏,但它仍然在 mysql 中给出 1 的值,是否需要进行任何调整或调整?

SELECT MBRWithin(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))')) 作为地理围栏状态

最佳答案

MySQL 5.6.1 及更高版本除了早期仅在 MBR 上运行的函数外,还具有精确几何算法

您可以使用 ST_WITHIN 而不是 MBR_WITHIN。参见 documentation .像这样

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

关于mysql - MBR 内在 mysql 中不准确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7782873/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com