4.28 SDO_TOPO_MAP.GET_NEAREST_NODE

Format

SDO_TOPO_MAP.GET_NEAREST_NODE(     
  topology IN VARCHAR2,      
  topo_map IN VARCHAR2,      
  point    IN SDO_GEOMETRY      
) RETURN NUMBER;

or

SDO_TOPO_MAP.GET_NEAREST_NODE(     
  topology IN VARCHAR2,      
  topo_map IN VARCHAR2,      
  x        IN NUMBER,      
  y        IN NUMBER      
) RETURN NUMBER;

Description

Returns the node ID number of the node that is nearest (closest to) the specified point.

Parameters

topology

Name of the topology that contains the node and the point, or a null value, as explained in Using GET_xxx Topology Functions. Must not exceed 20 characters.

topo_map

Name of the TopoMap object, or a null value, as explained in Using GET_xxx Topology Functions. (TopoMap objects are explained in TopoMap Objects.)

point

Geometry object specifying the point.

x

X-axis value of the point.

y

Y-axis value of the point.

Usage Notes

The topology or topo_map parameter should specify a valid name, as explained in Using GET_xxx Topology Functions.

The nearest node is determined from the representation of the topology in the database, using the spatial index. If there are changed, added, or deleted nodes in the instance and the database has not been updated to reflect those changes, the result may not reflect the true situation in the TopoMap object cache.

If multiple nodes are equally close to the point, any one of the node ID values is returned.

This function is equivalent to using the getNearestNode method of the TopoMap class of the client-side Java API (described in Topology Data Model Java Interface).

Examples

The following example returns the node ID number of the node that is closest to the point at (8, 8) in the CITY_DATA_TOPOMAP TopoMap object. (The example refers to definitions and data from Topology Built from Topology Data.)

SELECT SDO_TOPO_MAP.GET_NEAREST_NODE(null, 'CITY_DATA_TOPOMAP',
  SDO_GEOMETRY(2001, NULL, SDO_POINT_TYPE(8,8,NULL), NULL, NULL))
  FROM DUAL;
 
SDO_TOPO_MAP.GET_NEAREST_NODE(NULL,'CITY_DATA_TOPOMAP',SDO_GEOMETRY(2001,NULL,SD
--------------------------------------------------------------------------------
                                                                               8