Finds the closest point to a target point.
Syntax
01 SPOBJHANDLE PIC S9(9) BINARY.
01 LONG-IN PIC S9(9) BINARY.
01 LAT-IN PIC S9(9) BINARY.
01 SEARCH-DEPTH PIC S9(9) BINARY.
01 NEAREST-OUT PIC X(60).
01 OUTLEN PIC S9(9) BINARY VALUE 60.
01 SPRETCODE PIC S9(9) BINARY.
-
CALL ‘SPOFFNR'
USING SPOBJHANDLE, LONG-IN,
LAT-IN,
SEARCH-DEPTH, NEAREST-OUT, OUTLEN, SPRETCODE.
Arguments
SPOBJHANDLE The handle of the opened object file. Input.
LONG-IN The longitude (in millionths of degrees) or x coordinate defining the input point. Input.
LAT-IN The latitude (in millionths of degrees) or y coordinate defining the input point. Input.
SEARCH-DEPTH The maximum number of points to find. Input.
NEAREST-OUT A buffer to be filled with the identifier of the object in which the point is located. Output.
OUTLEN The size of the buffer that contains the identifier of the object in which the point is located. If the buffer size is smaller than the identifier, the identifier is truncated. Input.
Return Values
PIP-ERROR
PIP-NOT-FOUND PIP-OK
SPOFOP.
Prerequisites
Alternates
None.
Notes
The SEARCH-DEPTH parameter indicates the total number of points to search for. If this is set to 3, then SPOFFNR and SPOFN will not find more than 3 points, regardless of how many points are in the search tree. It is important to set this number carefully; setting too high a number may drastically increase the search time.
To get distance and bearing to the returned point, use SPDIST. If no points found, the procedure returns PIP-NOT-FOUND.