BigQuery GIS returns 不正确的值

BigQuery GIS returns incorrect value

根据 BigQuery GIS 工具,此纬度经度存在于下面的多边形集中,但 bigquery return 的值为假。为什么 bigquery return 错误值,即使坐标存在于多边形形状中。

select ST_Intersects(ST_GeogPoint(-5.4554914, 50.1822663), ST_GEOGFROMGEOJSON('{"type": "Polygon", "coordinates": [[[-5.45547968622094, 50.1821045770462], [-5.455482850644401, 50.18214838546901], [-5.45548927029794, 50.182237259112135], [-5.455494166115916, 50.18230503648512], [-5.455496215232034, 50.182333404232935], [-5.455499652048061, 50.18238098305004], [-5.455500300504948, 50.182389960185276], [-5.455478842541956, 50.18238772040404], [-5.455464007321631, 50.1823860030913], [-5.455427772503666, 50.1823828539281], [-5.455387373092614, 50.18237829938783], [-5.455372531393598, 50.182376492291915], [-5.455311734130676, 50.18236885666828], [-5.455274020622166, 50.18236269270239], [-5.455273302141769, 50.18236244420612], [-5.455263815607555, 50.18235912814621], [-5.455235928203027, 50.18234934285033], [-5.455228163993944, 50.18212934102841], [-5.45547968622094, 50.1821045770462]]]}'))

你能解释一下你的意思吗

As per BigQuery GIS tool this latitude longitude exists in below polygon

您可以使用 ST_Distance 函数检查点与多边形的距离:

select ST_Distance(
    ST_GeogPoint(-5.4554914, 50.1822663), 
    ST_GEOGFROMGEOJSON('{"type": "Polygon", "coordinates": [[[-5.45547968622094, 50.1821045770462], [-5.455482850644401, 50.18214838546901], [-5.45548927029794, 50.182237259112135], [-5.455494166115916, 50.18230503648512], [-5.455496215232034, 50.182333404232935], [-5.455499652048061, 50.18238098305004], [-5.455500300504948, 50.182389960185276], [-5.455478842541956, 50.18238772040404], [-5.455464007321631, 50.1823860030913], [-5.455427772503666, 50.1823828539281], [-5.455387373092614, 50.18237829938783], [-5.455372531393598, 50.182376492291915], [-5.455311734130676, 50.18236885666828], [-5.455274020622166, 50.18236269270239], [-5.455273302141769, 50.18236244420612], [-5.455263815607555, 50.18235912814621], [-5.455235928203027, 50.18234934285033], [-5.455228163993944, 50.18212934102841], [-5.45547968622094, 50.1821045770462]]]}'))

这个 returns 0.00227 - 或大约 2 毫米。它可能出现在多边形内,但实际上只是在多边形之外一点点。

如果您想要将此类近距离对象视为相交,请使用 ST_DWithin(g1, g2, max_distance) 条件,其中 max_distance 是以米为单位的对象之间的最大距离。