| S.No. | 功能和说明 |
| 1 |
ST_DISTANCE (point_expr, point_expr)
返回两个 GeoJSON 点表达式之间的距离。
|
| 2 |
ST_WITHIN (point_expr,polygon_expr)
返回一个布尔表达式,指示第一个参数中指定的 GeoJSON 点是否在第二个参数中的 GeoJSON 多边形内。
|
| 3 |
ST_ISVALID
返回一个布尔值,指示指定的 GeoJSON 点或多边形表达式是否有效。
|
| 4 |
ST_ISVALIDDETAILED
如果指定的 GeoJSON 点或多边形表达式有效,则返回包含布尔值的 JSON 值,如果无效,则另外以字符串形式返回原因价值。
|
{
"id": "case-university",
"name": "CASE: Center for Advanced Studies In Engineering",
"city": "Islamabad",
"location": {
"type": "Point",
"coordinates": [
33.7194136,
-73.0964862
]
}
}
{
"id": "nust",
"name": "National University of Sciences and Technology",
"city": "Islamabad",
"location": {
"type": "Point",
"coordinates": [
33.6455715,
72.9903447
]
}
}
SELECT u.id, u.name
FROM Universities u
WHERE ST_DISTANCE(u.location, {'type': 'Point', 'coordinates':[33.7,-73.0]}) < 30000
[
{
"id": "case-university",
"name": "CASE: Center for Advanced Studies In Engineering"
}
]
SELECT
ST_ISVALID({ "type": "Point", "coordinates": [32.9,-132.8] }) AS Point1,
ST_ISVALIDDETAILED({ "type": "Point", "coordinates": [31.9,-132.8] }) AS Point2
[
{
"Point1": false,
"Point2": {
"valid": false,
"reason": "Latitude values must be between-90 and 90 degrees."
}
}
]