<->
功能描述
计算对象之间的距离。
适用于POINT与另一种几何类型的所有组合,以及这些额外的类型对:(BOX, LSEG),(BOX, LINE),(LSEG, LINE),(POLYGON, CIRCLE),以及易子情况。
数据类型
L_OPERAND_TYP(左操作数类型) | R_OPERAND_TYP(右操作数类型) | RET_TYPE(返回类型) |
---|---|---|
POINT | POINT | DOUBLE |
POINT | BOX | |
POINT | LSEG | |
POINT | LINE | |
POINT | PATH | |
POINT | POLYGON | |
POINT | CIRCLE | |
BOX | POINT | |
BOX | BOX | |
BOX | LSEG | |
LINE | POINT | |
LINE | LSEG | |
LINE | LINE | |
LSEG | POINT | |
LSEG | BOX | |
LSEG | LSEG | |
LSEG | LINE | |
POLYGON | POINT | |
POLYGON | POLYGON | |
POLYGON | CIRCLE | |
PATH | POINT | |
PATH | PATH | |
CIRCLE | POINT | |
CIRCLE | POLYGON | |
CIRCLE | CIRCLE |
示例
计算圆到圆的距离
sqlSQL> SELECT CIRCLE('<(0,0),1>') <-> CIRCLE('<(5,0),1>'); EXPR1 | ------------------------------------------------------------------------------ 3.000000e+00 | Total 1 records.
计算点到线段的距离
sqlSQL> SELECT POINT('(0,0)') <-> LSEG('[(2,0),(0,2)]') ; EXPR1 | ------------------------------------------------------------------------------ 1.414214e+00 | Total 1 records.
计算圆到多边形的距离
sqlSQL> SELECT CIRCLE('<(0,0),1>') <-> POLYGON('( 10, 110, 20, 120, 30, 130, 40, 140)'); EXPR1 | ------------------------------------------------------------------------------ 1.094536e+02 | Total 1 records.