<#> — Gibt die 2D Entfernung zwischen den Bounding Boxes von A und B zurück
double precision <#>( geometry A , geometry B );
The <#> operator returns distance between two floating point bounding boxes, possibly reading them from a spatial index. Useful for doing nearest neighbor approximate distance ordering.
|
|
|
Dieser Operand verwendet sämtliche Indizes, welche für die Geometrien vorhanden sind. Er unterscheidet sich insofern von anderen Operatoren, welche ebenfalls räumliche Indizes verwenden, als der räumliche Index nur dann verwendet wird, falls sich der Operand in einer ORDER BY Klausel befindet. |
|
|
|
Der Index kommt nur zum Tragen, wenn eine der Geometrien eine Konstante ist; z.B.: ORDER BY (ST_GeomFromText('POINT(1 2)') <#> geom) anstatt g1.geom <#>. |
Availability: 2.0.0.
SELECT *
FROM (
SELECT b.tlid, b.mtfcc,
b.geom <#
> ST_GeomFromText('LINESTRING(746149 2948672,745954 2948576,
745787 2948499,745740 2948468,745712 2948438,
745690 2948384,745677 2948319)',2249) As b_dist,
ST_Distance(b.geom, ST_GeomFromText('LINESTRING(746149 2948672,745954 2948576,
745787 2948499,745740 2948468,745712 2948438,
745690 2948384,745677 2948319)',2249)) As act_dist
FROM bos_roads As b
ORDER BY b_dist, b.tlid
LIMIT 100) As foo
ORDER BY act_dist, tlid LIMIT 10;
tlid | mtfcc | b_dist | act_dist
-----------+-------+------------------+------------------
85732027 | S1400 | 0 | 0
85732029 | S1400 | 0 | 0
85732031 | S1400 | 0 | 0
85734335 | S1400 | 0 | 0
85736037 | S1400 | 0 | 0
624683742 | S1400 | 0 | 128.528874268666
85719343 | S1400 | 260.839270432962 | 260.839270432962
85741826 | S1400 | 164.759294123275 | 260.839270432962
85732032 | S1400 | 277.75 | 311.830282365264
85735592 | S1400 | 222.25 | 311.830282365264
(10 rows)