VECQueryRadius

Description

Demonstrates how to query for the shape ids within a specified radius of a 2D point location.

Remarks

Extract a list of all roads that come within five kilometers radius of a given location, and print their names.

Code

 local int ptr road_list, Vertex location
 local int i, int tfid, int segment_num

 location.x = 432608.0
 location.y = 3725824.0

 segment_num = 25
 printf "Center point 432608E and 3725824 N\n"
 try
    tfid = DBOpen(GetPCIHOME()+"/demo/irvine.pix", "r")
    road_list = VECQueryRadius( tfid, segment_num, location, 5000 )
                          
    for i = 1 to f$len(road_list)
        printf "Road with shape number %d and shape id %d within 5 km radius.\n", \
                road_list(i), VECGetField(tfid, segment_num, road_list(i), 1)
    endfor

    call DBClose( tfid)
    call EFree( road_list )
 onerror
    print "Error: ", GetLastErrorMessage()
 endonerror

Output

 Center point 432608E and 3725824 N
 Road with shape number 39 and shape id 1700210 within 5 km radius.
 Road with shape number 44 and shape id 1700210 within 5 km radius.
 Road with shape number 45 and shape id 1700210 within 5 km radius.
 ...

See also

DBClose()

DBOpen()

VECQueryRadius()

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.