MemSql GEOGRAPHY_DISTANCE,GEOGRAPHY_CONTAINS,GEOGRAPHY_WITHIN_DISTANCE 不工作并返回 null

MemSql GEOGRAPHY_DISTANCE,GEOGRAPHY_CONTAINS,GEOGRAPHY_WITHIN_DISTANCE is not working and returning null

It is not returning any figure, It is returning null.

SELECT round(GEOGRAPHY_DISTANCE("GEOGRAPHY_POINT(-97.741890, 30.219940)", "POLYGON ((-97.11090087890626 33.08693925905123,-96.52862548828126 33.063924198120645,-96.56158447265626 32.80343616698929,-97.06970214843751 32.778037985363675,-97.11090087890626 33.08693925905123))"),0) FROM DUAL;

SELECT GEOGRAPHY_WITHIN_DISTANCE("GEOGRAPHY_POINT(96.843820, 32.926290)","POLYGON ((-97.11090087890626 33.08693925905123,-96.52862548828126 33.063924198120645,-96.56158447265626 32.80343616698929,-97.06970214843751 32.778037985363675,-97.11090087890626 33.08693925905123))",1000) from dual;

任何人都可以帮助使这个 memsql 地理空间函数工作

扩展上面 Damien_The_Unbeliever 的回答,GEOGRAPHY_POINT 语法不应该在字符串中。您可以使用 WKT 语法 POINT(long lat) 或使用 GEOGRAPHY_POINT 语法(但不能在字符串中)定义字符串中的点。

因此,对于您的第一个无效查询:

memsql> SELECT round(GEOGRAPHY_DISTANCE("GEOGRAPHY_POINT(-97.741890, 30.219940)", "POLYGON ((-97.11090087890626 33.08693925905123,-96.52862548828126 33.063924198120645,-96.56158447265626 32.80343616698929,-97.06970214843751 32.778037985363675,-97.11090087890626 33.08693925905123))"),0) FROM DUAL;
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| round(GEOGRAPHY_DISTANCE("GEOGRAPHY_POINT(-97.741890, 30.219940)", "POLYGON ((-97.11090087890626 33.08693925905123,-96.52862548828126 33.063924198120645,-96.56158447265626 32.80343616698929,-97.06970214843751 32.778037985363675,-97.11090087890626 33.086939 |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                                                                                                                                                                                                             NULL |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set, 1 warning (0.39 sec)

memsql> show warnings;
+---------+------+----------------------------------------------------+
| Level   | Code | Message                                            |
+---------+------+----------------------------------------------------+
| Warning | 1862 | You have an error in your WKT syntax at position 0 |
+---------+------+----------------------------------------------------+
1 row in set (0.00 sec)

你可以正确地写成这两个中的任何一个:

memsql> SELECT round(GEOGRAPHY_DISTANCE("POINT(-97.741890 30.219940)", "POLYGON ((-97.11090087890626 33.08693925905123,-96.52862548828126 33.063924198120645,-96.56158447265626 32.80343616698929,-97.06970214843751 32.778037985363675,-97.11090087890626 33.08693925905123))"),0) FROM DUAL;
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| round(GEOGRAPHY_DISTANCE("POINT(-97.741890 30.219940)", "POLYGON ((-97.11090087890626 33.08693925905123,-96.52862548828126 33.063924198120645,-96.56158447265626 32.80343616698929,-97.06970214843751 32.778037985363675,-97.11090087890626 33.08693925905123))" |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                                                                                                                                                                                                           291334 |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.31 sec)

memsql> SELECT round(GEOGRAPHY_DISTANCE(GEOGRAPHY_POINT(-97.741890, 30.219940), "POLYGON ((-97.11090087890626 33.08693925905123,-96.52862548828126 33.063924198120645,-96.56158447265626 32.80343616698929,-97.06970214843751 32.778037985363675,-97.11090087890626 33.08693925905123))"),0) FROM DUAL;
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| round(GEOGRAPHY_DISTANCE(GEOGRAPHY_POINT(-97.741890, 30.219940), "POLYGON ((-97.11090087890626 33.08693925905123,-96.52862548828126 33.063924198120645,-96.56158447265626 32.80343616698929,-97.06970214843751 32.778037985363675,-97.11090087890626 33.08693925 |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                                                                                                                                                                                                           291334 |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.54 sec)