[postgis-users] Nearest Operator
Roy Irwan
mroy at centrin.net.id
Thu May 8 20:36:46 PDT 2003
----- Original Message -----
From: <chodgson at ref...>
Sent: Thursday, May 08, 2003 11:15 PM
> I am not very familiar with Oracle spatial, could you tell me exactly what
the
> parameters and output of the this "nearest" function are?
In Oracle Spatial, we can find the nearest neighbors for a geometry using
SDO_NN operator. It has 4 input params.
The 1st param is the geometry column in a table. The nearest neighbor(s)
will
be return from this column.
The 2nd param is a geometry that can take from a table or a transient
instance of a geometry.
The 3rd param determines the behavior of the operator, like how many geoms
you expect as the result, unit of measurement and how many rows to be
evaluated at a time.
The 4th param is an optional. This param is used if you would like to return
the distance for each neighbor.
Because this is an operator, we only can use it under WHERE condition an
compare it with string 'TRUE'.
For example:
SELECT c.mkt_id, c.name
FROM cola_markets c
WHERE SDO_NN(c.shape, mdsys.sdo_geometry(2001, NULL,
mdsys.sdo_point_type(10,7,NULL), NULL,
NULL), ’sdo_num_res=2’) = ’TRUE’;
I took the example from Oracle Spatial User's Guide and Ref ver 9.2.
> I guess the simplest
> answer to your question would be: "Is the 'nearest' operator in the OGC
SFSQL
> spec?" - if it is, then it will almost certainly be implemented this
summer,
> because the primary goal right now for PostGIS is to reach SFSQL
compliance.
I've been quick review the OGC SFS for SQL rev. 1.1, unfortunately there is
no 'nearest' operator. :(
> If it is not in the spec, then I would suggest that you could try to
implement it
> yourself, I'm sure we would include such a function in the distribution,
> if you sent it to us.
Wish I could do that. Unfortunately, I'm not too familiar with Linux env
development. And I'm a new comer in PostgreSQL + PostGIS world. So, this is
could be a long road for me. However, I'll try to do my best (not a
promise). :)
> Later,
> Chris
Rgds,
Roy
More information about the postgis-users
mailing list